Bayonne2 / Common C++ 2 Framework
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
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 Runlist:
Inheritance graph
[legend]
Collaboration diagram for Runlist:
Collaboration graph
[legend]

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...
 
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...
 

Static Public Member Functions

static void  setDebug (bool mode)
  Enable or disable deadlock debugging. More...
 

Protected Member Functions

void  check (void)
 

Protected Attributes

unsigned  limit
 
unsigned  used
 

Private Attributes

 
 

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.

Definition at line 708 of file misc.h.

Constructor & Destructor Documentation

Runlist::Runlist ( unsigned  count = 1 )

Create a new runlist with a specified limit.

Parameters
count limit before wait queuing.

Member Function Documentation

bool Runlist::add ( Runablerun )

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
run pointer to runable object.
void Runlist::check ( void  )
protected
void Runlist::del ( Runablerun )

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

Parameters
run pointer to runable object.
void Mutex::enter ( void  )
inlineinherited

Future abi will use enter/leave/test members.

Definition at line 263 of file thread.h.

void Mutex::enterMutex ( void  )
inherited

Entering a Mutex locks the mutex for the current thread.

This also can be done using the ENTER_CRITICAL macro or by using the ++ operator on a mutex.

See Also
leaveMutex
void Mutex::leave ( void  )
inlineinherited

Future abi will use enter/leave/test members.

Definition at line 269 of file thread.h.

void Mutex::leaveMutex ( void  )
inherited

Leaving a mutex frees that mutex for use by another thread.

If the mutex has been entered (invoked) multiple times (recursivily) by the same thread, then it will need to be exited the same number of instances before it is free for re-use. This operation can also be done using the LEAVE_CRITICAL macro or by the – operator on a mutex.

See Also
enterMutex
void Mutex::nameMutex ( const char *  name )
inlineinherited

Enable setting of mutex name for deadlock debug.

Parameters
name for mutex.

Definition at line 248 of file thread.h.

void Runlist::set ( unsigned  limit )

Set the limit.

Parameters
limit to use.
static void Mutex::setDebug ( bool  mode )
inlinestaticinherited

Enable or disable deadlock debugging.

Parameters
mode debug mode.

Definition at line 240 of file thread.h.

bool Mutex::test ( void  )
inlineinherited

Future abi will use enter/leave/test members.

Returns
true if entered.

Definition at line 277 of file thread.h.

bool Mutex::tryEnterMutex ( void  )
inherited

Tries to lock the mutex for the current thread.

Behaves like enterMutex , except that it doesn't block the calling thread if the mutex is already locked by another thread.

Returns
true if locking the mutex was succesful otherwise false
See Also
enterMutex
leaveMutex

Field Documentation

Runable* Runlist::first
private

Definition at line 711 of file misc.h.

Runable * Runlist::last
private

Definition at line 711 of file misc.h.

unsigned Runlist::limit
protected

Definition at line 714 of file misc.h.

unsigned Runlist::used
protected

Definition at line 714 of file misc.h.


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

Generated on Dec 21, 2017 for commoncpp2-1.8.1, ccrtp-1.7.2, libzrtpcpp-2.3.4, ccscript3-1.1.7, ccaudio2-1.0.0 and bayonne2-2.3.2 (after installation in /usr/local/) by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /