tac0S
Template Affectional Command Operating System
Public Member Functions | List of all members
SynchList Class Reference

The following class defines a "synchronized list" – a list for which: these constraints hold: More...

#include <synchlist.h>

Public Member Functions

 SynchList ()
 SynchList::SynchList Allocate and initialize the data structures needed for a synchronized list, empty to start with. Elements can now be added to the list.
 
 ~SynchList ()
 SynchList::~SynchList De-allocate the data structures created for synchronizing a list.
 
void Append (void *item)
 SynchList::Append Append an "item" to the end of the list. Wake up anyone waiting for an element to be appended. More...
 
void * Remove ()
 SynchList::Remove Remove an "item" from the beginning of the list. Wait if the list is empty. Returns: More...
 
void Mapcar (VoidFunctionPtr func)
 SynchList::Mapcar Apply function to every item on the list. Obey mutual exclusion constraints. More...
 
void * get (unsigned int index)
 SynchList::get Get an object at the place "i". More...
 
unsigned int size ()
 SynchList::size Return the size of the current list. More...
 
void GetTheLock ()
 SynchList::GetTheLock Execute an acquire to the lock, then the kernel could use the list for thread management;.
 
void FreeTheLock ()
 SynchList::FreeTheLock Execute a release to the lock, then the kernel stop use the list for thread management;.
 
ListgetList ()
 SynchList::getList Return the list, for thread management utilisation. More...
 
bool IsEmpty ()
 SynchList::IsEmpty Know if the synchlist is empty or not. More...
 

Detailed Description

The following class defines a "synchronized list" – a list for which: these constraints hold:

  1. Threads trying to remove an item from a list will wait until the list has an element on it.
  2. One thread at a time can access list data structures

Member Function Documentation

void SynchList::Append ( void *  item)

SynchList::Append Append an "item" to the end of the list. Wake up anyone waiting for an element to be appended.

Parameters
void * SynchList::get ( unsigned int  index)

SynchList::get Get an object at the place "i".

Parameters
int index: the place where it should be
Returns
"void *" : return the adress of the object, null if impossible
List * SynchList::getList ( )

SynchList::getList Return the list, for thread management utilisation.

Returns
list : a List
bool SynchList::IsEmpty ( )

SynchList::IsEmpty Know if the synchlist is empty or not.

Returns
Boolean true or false
void SynchList::Mapcar ( VoidFunctionPtr  func)

SynchList::Mapcar Apply function to every item on the list. Obey mutual exclusion constraints.

Parameters
funcis the procedure to be applied.
void * SynchList::Remove ( )

SynchList::Remove Remove an "item" from the beginning of the list. Wait if the list is empty. Returns:

Returns
The removed item.
unsigned int SynchList::size ( )

SynchList::size Return the size of the current list.

Returns
"unsigned int" : the size of the list

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