uThreads  0.3.0
Public Member Functions | Static Public Member Functions | Friends | List of all members
BlockingQueue Class Reference

A queue used to keep track of blocked uThreads. More...

#include <BlockingSync.h>

Public Member Functions

 BlockingQueue (const BlockingQueue &)=delete
 BlockingQueue cannot be copied or assigned.
 
const BlockingQueueoperator= (const BlockingQueue &)=delete
 BlockingQueue cannot be copied or assigned.
 
bool empty () const
 Whether the queue is empty or not.
 
bool suspend (std::mutex &lock)
 Suspends the uThread and add it to the queue. More...
 
bool suspend (Mutex &)
 Suspends the uThread and add it to the queue. More...
 
bool signal (std::mutex &lock, uThread *&owner)
 Unblock one blocked uThread, used for OwnerLock. More...
 
bool signal (std::mutex &lock)
 unblock one blocked, used for Mutex More...
 
bool signal (Mutex &)
 unblock one blocked uThread, used for ConditionVariable More...
 
void signalAll (Mutex &)
 unblock all blocked uThreads, used for Condition Variable More...
 

Static Public Member Functions

template<typename T >
static void postSwitchFunc (void *ut, void *args)
 

Friends

class uThread
 
class Mutex
 
class OwnerLock
 
class ConditionVariable
 
class Semaphore
 

Detailed Description

A queue used to keep track of blocked uThreads.

This queue is a FIFO queue used to hold blocked uThreads on Mutex, Semaphore, or Condition Variable.

Member Function Documentation

bool BlockingQueue::signal ( std::mutex &  lock,
uThread *&  owner 
)

Unblock one blocked uThread, used for OwnerLock.

Parameters
lockmutex to be released after signal is done
ownerpassed to support atomic setting of Mutex::owner
Returns
true if a uThread was unblocked, and false otherwise
bool BlockingQueue::signal ( std::mutex &  lock)
inline

unblock one blocked, used for Mutex

Parameters
lockmutex to be released after signal is done
Returns
true if a uThread was unblocked, and false otherwise
bool BlockingQueue::signal ( Mutex mutex)

unblock one blocked uThread, used for ConditionVariable

Parameters
Mutexthat is released after signal is done
Returns
true if a uThread was unblocked, and false otherwise
void BlockingQueue::signalAll ( Mutex mutex)

unblock all blocked uThreads, used for Condition Variable

Parameters
Mutexto be released after signallAll is done
bool BlockingQueue::suspend ( std::mutex &  lock)

Suspends the uThread and add it to the queue.

Parameters
locka mutex to be released after blocking
Returns
whether the suspension was successful or not

Suspends the uThread and adds it to the BlockingQueue.

bool BlockingQueue::suspend ( Mutex mutex)

Suspends the uThread and add it to the queue.

Parameters
locka mutex to be released after blocking
Returns
whether the suspension was successful or not

Suspends the uThread and adds it to the BlockingQueue.


The documentation for this class was generated from the following files: