Public Member Functions

com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock Class Reference

List of all members.

Public Member Functions

 ReferenceCountingLock ()
boolean acquire (long msecs)
void release ()
int referenceCount ()
int increment ()
int decrement ()

Detailed Description

Synchronization helper class used for activation/deactivation synchronization. This class enforces attempt method of acquiring the locks to prevent deadlocks. Class also offers reference counting. (NOTE: automatic lock counting was not implemented due to imperfect usage.)

Example of usage: ReferenceCountingLock lock; if (lock.acquire(3*Sync.ONE_MINUTE)) { try { // critical section here } finally { lock.release(); } } else { throw new TimoutException("Deadlock detected..."); }


Constructor & Destructor Documentation

com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock.ReferenceCountingLock (  ) 

Constructor of ReferenceCountingLock. After construction lock is free and reference count equals 1.


Member Function Documentation

boolean com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock.acquire ( long  msecs  ) 

Attempt to acquire lock.

Parameters:
msecs the number of milliseconds to wait. An argument less than or equal to zero means not to wait at all.
Returns:
true if acquired, false othwerwise.
int com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock.decrement (  ) 

Decrement number of references.

Returns:
number of references.
int com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock.increment (  ) 

Increment number of references.

Returns:
number of references.
int com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock.referenceCount (  ) 

Get number of references.

Returns:
number of references.
void com.cosylab.acs.maci.manager.ManagerImpl.ReferenceCountingLock.release (  ) 

Release previously acquired lock.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties