GNU CommonC++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ost::Runlist Class Reference

A runlist is used to restrict concurrent exection to a limited set of concurrent sessions, much like a semaphore. More...

#include <misc.h>

Inheritance diagram for ost::Runlist:
ost::Mutex

Public Member Functions

 Runlist (unsigned count=1)
 Create a new runlist with a specified limit. More...
 
bool add (Runable *run)
 Add a runable object to this runlist. More...
 
void del (Runable *run)
 Remove a runable object from the wait list or notify when it is done running so that the used count can be decremented. More...
 
void set (unsigned limit)
 Set the limit. More...
 
- Public Member Functions inherited from ost::Mutex
 Mutex (const char *name=NULL)
 The mutex is always initialized as a recursive entity. More...
 
virtual ~Mutex ()
 Destroying the mutex removes any system resources associated with it. More...
 
void nameMutex (const char *name)
 Enable setting of mutex name for deadlock debug. More...
 
void enterMutex (void)
 Entering a Mutex locks the mutex for the current thread. More...
 
void enter (void)
 Future abi will use enter/leave/test members. More...
 
void leave (void)
 Future abi will use enter/leave/test members. More...
 
bool test (void)
 Future abi will use enter/leave/test members. More...
 
bool tryEnterMutex (void)
 Tries to lock the mutex for the current thread. More...
 
void leaveMutex (void)
 Leaving a mutex frees that mutex for use by another thread. More...
 

Protected Member Functions

void check (void)
 

Protected Attributes

unsigned limit
 
unsigned used
 

Additional Inherited Members

- Static Public Member Functions inherited from ost::Mutex
static void setDebug (bool mode)
 Enable or disable deadlock debugging. More...
 

Detailed Description

A runlist is used to restrict concurrent exection to a limited set of concurrent sessions, much like a semaphore.

However, the runlist differs in that it notifies objects when they become ready to run, rather than requiring them to wait and "block" for the semaphore count to become low enough to continue.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

list of runable objects.

Constructor & Destructor Documentation

◆ Runlist()

ost::Runlist::Runlist ( unsigned  count = 1)

Create a new runlist with a specified limit.

Parameters
countlimit before wait queuing.

Member Function Documentation

◆ add()

bool ost::Runlist::add ( Runable run)

Add a runable object to this runlist.

If the number of entries running is below the limit, then add returns true otherwise the entry is added to the list.

Returns
true if immediately ready to run
Parameters
runpointer to runable object.

◆ check()

void ost::Runlist::check ( void  )
protected

◆ del()

void ost::Runlist::del ( Runable run)

Remove a runable object from the wait list or notify when it is done running so that the used count can be decremented.

Parameters
runpointer to runable object.

◆ set()

void ost::Runlist::set ( unsigned  limit)

Set the limit.

Parameters
limitto use.

Member Data Documentation

◆ limit

unsigned ost::Runlist::limit
protected

◆ used

unsigned ost::Runlist::used
protected

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