class TISTQueue

Thread safe queue. More...

Definition#include <classlib/include/classlib/squeue.h>
Template formTISTQueue<class T>
InheritsTIQueueAsDoubleList [private ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members

Protected Members

Private Types


Detailed Description

Thread safe queue. This class implements a thread safe queue ready to use in multitread application. The queue have a CriticalSection (see) for syncronization of insertion end extraction from the queue. It can notify a waiting thread when new item are inserted into the queue (see the LockIfEmpty method). The internal implementation is a linked list queue.

typedef TIQueueAsDoubleList Parent

Parent

[private]

friend class TISTQueueIterator

TISTQueueIterator

 TISTQueue ()

TISTQueue

Construct the queue and the semaphore in non blocking state

T * Get ()

Get

Get an element from the queue. The get operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

void  Put ( T *t )

Put

Put an element into the queue. The put operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

void  Flush ()

Flush

Destroy all elements into the queue. The flush operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

int  Detach ( T *t )

Detach

Detach an element from the queue. The detach operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

typedef void  (*IterFunc) (T&, void *)

(*IterFunc)

typedef int  (*CondFunc) (const T&, void *)

(*CondFunc)

void  ForEach ( IterFunc iter, void *args )

ForEach

auto iterator: use an iterator function calling it for every element of the array; the function must have a prototype like this: void iterFunc(T&, void* args); The operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

T * FirstThat ( CondFunc cond, void *args )

FirstThat

auto iterator: use a test function calling it for every element of the array; the function must have a prototype like this: int testFunc(const T&, void* args); the function must return 0 if the test fail, != 0 if test is ok; the first element tested successful will be returned or NULL if no elements is ok. The operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

T * LastThat ( CondFunc cond, void *args )

LastThat

auto iterator: use a test function calling it for every element of the array; the function must have a prototype like this: int testFunc(const T&, void* args); the function must return 0 if the test fail, != 0 if test is ok; the last element tested successful will be returned or NULL if no elements is ok. The operation request the lock of a CriticalSection (see) to proceed. The calling thread will be locked if another thread is accessing another lock method.

void  LockIfEmpty ()

LockIfEmpty

CCriticalSection csec

csec

[protected]

CEvent evitem

evitem

[protected]


Generated by: nicola on gulliver.wadahome.it on Sun May 25 13:54:34 2003, using kdoc 2.0a53.