18#ifndef _DECAF_UTIL_CONCURRENT_LOCKS_ABSTRACTQUEUEDSYNCHRONIZER_H_
19#define _DECAF_UTIL_CONCURRENT_LOCKS_ABSTRACTQUEUEDSYNCHRONIZER_H_
33 class SynchronizerState;
35 class DECAF_API AbstractQueuedSynchronizer :
public AbstractOwnableSynchronizer {
42 AbstractQueuedSynchronizer(
const AbstractQueuedSynchronizer&);
43 AbstractQueuedSynchronizer& operator= (
const AbstractQueuedSynchronizer&);
62 ConditionObject(
const ConditionObject&);
63 ConditionObject& operator= (
const ConditionObject&);
A Thread is a concurrent unit of execution.
Definition Thread.h:64
The root interface in the collection hierarchy.
Definition Collection.h:69
Condition object for this Synchronizer, which serves as the basis for other Lock objects.
Definition AbstractQueuedSynchronizer.h:55
ConditionObject()
Definition AbstractQueuedSynchronizer.h:67
virtual int getWaitQueueLength() const =0
Calculates and returns an estimate of the number of Threads that are waiting on this Condition object...
virtual bool isOwnedBy(const AbstractQueuedSynchronizer *sync) const =0
Used to check on the ownership status of this ConditionObject.
virtual Collection< decaf::lang::Thread * > * getWaitingThreads() const =0
Retrieves a new Collection object that contains Threads that may be waiting on this Condition object.
friend class AbstractQueuedSynchronizer
Definition AbstractQueuedSynchronizer.h:58
virtual bool hasWaiters() const =0
Returns true if there are any waiters on this Condition object at the time of its calling.
virtual ~ConditionObject()
Definition AbstractQueuedSynchronizer.h:68
virtual void setState(int value)
Sets the synchronization state to the given value.
bool owns(const AbstractQueuedSynchronizer::ConditionObject *condition) const
Checks whether the given ConditionObject uses this Synchronizer as its lock object.
void acquire(int arg)
Acquire the lock exclusively, ignoring interrupts.
virtual int getState() const
Gets and returns the currently set value of this object Synchronization sate.
bool hasQueuedThreads() const
Collection< decaf::lang::Thread * > * getQueuedThreads() const
Creates and returns a new Collection object that contains a best effort snapshot of the threads that ...
virtual bool tryAcquire(int arg)
Performs the actual work of attempting to acquire the lock in exclusive mode.
Collection< decaf::lang::Thread * > * getExclusiveQueuedThreads() const
Creates and returns a new Collection object that contains only those threads that may be waiting to a...
bool hasContended() const
AbstractQueuedSynchronizer()
bool hasQueuedPredecessors() const
Queries whether any threads have been waiting to acquire longer than the current thread.
virtual bool compareAndSetState(int expect, int update)
Sets the synchronization state to the specified value if the current value is equal to the expected v...
std::string toString() const
Gets a string that identifies this Synchronizer along with its present state.
bool hasWaiters(const AbstractQueuedSynchronizer::ConditionObject *condition) const
Returns true if there are any threads that are currently waiting on the given ConditionObject,...
virtual bool tryReleaseShared(int arg)
Performs a release for the calling thread in shared mode.
Collection< decaf::lang::Thread * > * getSharedQueuedThreads() const
Creates and returns a new Collection object that contains only those threads that may be waiting to a...
void acquireInterruptibly(int arg)
Acquire the lock exclusively, allowing for interrupts.
bool isQueued(decaf::lang::Thread *thread) const
Traverse the Queue if waiting threads to see if the given thread is present.
void acquireSharedInterruptibly(int arg)
Acquire the lock in shared mode, allowing interruption.
virtual bool isHeldExclusively() const
If the calling thread hold an exclusive lock on this synchronization then this method returns true,...
virtual bool tryRelease(int arg)
Performs a release for the calling thread in exclusive mode.
bool releaseShared(int arg)
When held in shared mode this method releases the Synchronizer.
virtual ConditionObject * createDefaultConditionObject()
Provides a means for derived classes to create a ConditionObject implemented by the basic logic imple...
friend class SynchronizerState
Definition AbstractQueuedSynchronizer.h:492
virtual int tryAcquireShared(int arg)
Performs the actual work of attempting to acquire the lock in shared mode.
decaf::lang::Thread * getFirstQueuedThread() const
Returns the first thread queue (the thread that's been waiting the longest) if there are currently no...
virtual ~AbstractQueuedSynchronizer()
bool tryAcquireSharedNanos(int arg, long long nanos)
Acquires in shared mode if possible, first checking if the calling thread has already been interrupte...
bool tryAcquireNanos(int arg, long long nanos)
Acquires in exclusive mode if possible, first checking if the calling thread has already been interru...
int getWaitQueueLength(const AbstractQueuedSynchronizer::ConditionObject *condition) const
Gets an estimated count of the number of threads that are currently waiting on the given ConditionObj...
bool release(int arg)
When held in exclusive mode this method releases the Synchronizer.
Collection< decaf::lang::Thread * > * getWaitingThreads(const AbstractQueuedSynchronizer::ConditionObject *condition) const
Creates and returns a new Collection object that contains all the threads that may be waiting on the ...
void acquireShared(int arg)
Acquire the lock in shared mode, ignoring interrupts.
int getQueueLength() const
Gets an estimated count of the number of threads that are currently waiting to acquire,...
Condition factors out the Mutex monitor methods (wait, notify and notifyAll) into distinct objects to...
Definition Condition.h:132
#define DECAF_API
Definition Config.h:29
Definition AbstractOwnableSynchronizer.h:29
Definition AbstractExecutorService.h:28
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25