Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Wefts Namespace Reference
[Advanced Syncronization constructs]

The Wefts++ namespace. More...


Classes

class  Barrier
 Programmable fence object. More...

class  CleanupHandler
 Cleanup handler interface. More...

class  CleanupItem
 Item representing a cleanup handler and its parameters. More...

class  CondCleanup
 Basic condition cleanup. More...

class  Condition
 Class implementing a condition variable. More...

class  Counter
 Syncrhonizable counter. More...

class  CriticalSection
class  Error
 Generic error class This is meant to be overloaded by specific error classes below. More...

class  FastCondition
 Fast mutex + condition structure wrapper. More...

class  InitError
 Error risen when there is an object can't be initialized. More...

class  InvalidError
 Error risen if an object is in an invalid state while being used. More...

class  MoaningThread
 A thread subclass supporting an arbitrary number of joiners. More...

class  Mutex
 Implements a very fast, non reentrant mutex. More...

class  NotJoinableError
 Error risen when the thread tries to join a detached thread. More...

class  OSConditionBase
 This class implement an os-dependant condition. More...

class  OSConditionPthread
 This class implement an os-dependant condition. More...

class  OSConditionWindows
 This class implement an os-dependant condition. More...

class  OSFileFuncBase
 Abstracts an OS specific file fucntion set. More...

class  OSFileFuncUnix
 OS COFFEE Unix implementation. More...

class  OSFileFuncWin
 Implements COFFEE file specific extensions for MS-Windows. More...

class  OSMutexBase
 Implements an OS specific mutex This mutex class is not supposed to be reentrant, but it is supposed to have an trylock() feature at OS level. More...

class  OSMutexPthread
class  OSMutexWindows
 Windows implementation of mutex. More...

class  OSSpecificDataBase
 Wrapper class for thread specific data access (tsd/tls). More...

class  OSSpecificDataPthread
 Wrapper class for pthread specific data access (tsd/tls). More...

class  OSSpecificDataWindows
 Wrapper class for thread specific data access (tsd/tls). More...

class  OSThreadBase
 Thread OS layer abstraction This class can be rewritten in other header files to implement different os specific threading system. More...

class  OSThreadPthread
 Wraps Posix threads. More...

class  OSThreadWindows
 Wraps Windows threads. More...

class  Queue
 Waitable template FIFO structure. More...

class  RCondition
 Reentrant mutex + condition structure wrapper. More...

class  Referenced
 Shared object between threads implementing reference count and self-cancelation. More...

class  RingBuffer
 Ring buffer synchronization object. More...

class  RMutex
 This is a reentrant mutex with spinlock. More...

class  RRWMutex
 This is an advanced (and fully reentrant) read/write mutex. More...

class  RWMutex
 This is a read/write mutex. More...

class  Semaphore
 Semaphore semantic. More...

class  Stack
 Waitable template LIFO structure. More...

class  StartError
 Error risen when is not possible to start other threads anymore. More...

class  Subscription
 Subscribe/notify model abstraction. More...

struct  tag_ThreadAndReturn
 Utility structure to pass around a thread object along with its return. More...

class  Thread
 Implements the abstraction of a thread. More...

class  ThreadPtr
 Implements a very fast thread specific data. More...

class  XMutex
 Advanced mutex class. More...


Typedefs

typedef std::stack< CleanupItemCleanupList
 List of cleanup actions to be taken.

typedef long long file_size_t
 The longest integer available on the platform.

typedef OSFileFuncUnix OSFileFunc
 Definition that hooks COFFEE in your application.

typedef Wefts::tag_ThreadAndReturn ThreadAndReturn
 Utility structure to pass around a thread object along with its return.

typedef OSSpecificDataPthread OSSpecificData
 Function to execute the thread RUN procedure guarded by OS cleanup.

typedef OSThreadPthread OSThread
typedef OSConditionPthread OSCondition
typedef OSMutexPthread OSMutex

Enumerations

enum  LockMode { LM_SHARED, LM_SHARED_RO, LM_EXCLUSIVE }
 Basic locking schemes used by various systems at open time. More...

enum  OpenMode {
  OM_RO, OM_WO, OM_RW, OM_TRUNC_WO,
  OM_TRUNC_RW, OM_APPEND_WO, OM_APPEND_RW
}
 Basic open modes used by various systems. More...

enum  CreateMode {
  CM_ARCHIVE, CM_SYSTEM, CM_EXECUTABLE, CM_PRIVATE,
  CM_PRIVATE_EX
}
 Creation modes. More...

enum  CffStatus {
  CFF_DONE, CFF_WAITING, CFF_TIMEDOUT, CFF_SOFTERROR,
  CFF_HARDERROR, CFF_PROGERROR
}
 Cooperative File Functions Status. More...

enum  SeekWhence { SW_FROM_BEGIN = 0, SW_FROM_CUR = 1, SW_FROM_CURENT = 1, SW_FROM_END = 2 }
 Position indicators for file seeks. More...

enum  OSPriority {
  PrioRealTime = 0, PrioHigh = 1, PrioNormal = 2, PrioLow = 3,
  PrioIdle = 4
}
 Portable priority concept. More...


Functions

std::string OSErrorDescription (int osCode)
 Function to report OS specific error.

bool OSSleep (long nSeconds, long nNanoseconds)
 Function to provide a wefts-interruptable wait.

void wefts_pthread_cond_guard (void *param)
 This function is used internally by pthread module to safely guard the condition on async cancelation.

void wefts_pthread_cond_reset (void *param)
bool Sleep (long seconds, long nanoseconds)
 Sleeps a certain amount of time.

bool Sleep (double seconds)
 Sleeps a certain amount of time.

CounterstartedThreads ()
 Incremental counter of started threads.

VOID CALLBACK s_opCompleted (DWORD dwErrorCode, DWORD dwCount, LPOVERLAPPED lpOverlapped)
DWORD WINAPI s_asyncRead (LPVOID Cargo)
DWORD WINAPI s_asyncWrite (LPVOID Cargo)
std::ostream & operator<< (std::ostream &stream, Error &err)
void s_ThreadCleanupper (void *param)
 Function used (internally) to invoke thread->cleanup() in case of cancelation.

void * s_ThreadRunner (void *data)
void * s_ThreadRunFunc (void *param)
 Function used (internally) to invoke thread->run().

Counter runningThreads (1)
 Counter of currently active (or near-to-be active) threads.


Variables

CondCleanup BasicConditionCleanup
DWORD s_tlsThreadObj = TLS_OUT_OF_INDEXES
void(* s_cleanerPointer )(void *)
Counter runningThreads
 Counter of currently active (or near-to-be active) threads.


Detailed Description

The Wefts++ namespace.

All the wefts classes and functions are available under Wefts namespace; they are rather thread specific, so if you are using Wefts++ alone, without any other threading library, you will be pretty safe in adding:

   #include <wefts.h>

   using namespace Wefts;

Otherwise, you will have to prefix all Wefts++ calls with the namespace:

   #include <wefts.h>

   int main( int argc, char *argv[] )
   {
      //sleeping a while..
      Wefts::Sleep( 1.5 );
   }


Typedef Documentation

typedef std::stack< CleanupItem > Wefts::CleanupList
 

List of cleanup actions to be taken.


Function Documentation

std::ostream& operator<< std::ostream &  stream,
Error &  err
 

Use this operator to display what kind of error has happened

Counter runningThreads  ) 
 

Counter of currently active (or near-to-be active) threads.

Initialized to 1: if we initialized it, the main thread is running...

DWORD WINAPI s_asyncRead LPVOID  Cargo  )  [static]
 

DWORD WINAPI s_asyncWrite LPVOID  Cargo  )  [static]
 

VOID CALLBACK s_opCompleted DWORD  dwErrorCode,
DWORD  dwCount,
LPOVERLAPPED  lpOverlapped
[static]
 

void s_ThreadCleanupper void *  param  ) 
 

Function used (internally) to invoke thread->cleanup() in case of cancelation.

As this function is the only one that has the right to delete the thread object in case of detached thread, this function is also responsible to set the m_runReturn parameter in case the thread is NOT detached. For this reasion, this function is fed with a ThreadAndReturn pointer as parameter.

Parameters:
param a ThreadAndReturn structure pointer, containing the thread object and the run return value, if the run function had the chance to return, or 0 otherwise.

void* s_ThreadRunFunc void *  param  ) 
 

Function used (internally) to invoke thread->run().

void* s_ThreadRunner void *  data  ) 
 


Variable Documentation

CondCleanup Wefts::BasicConditionCleanup
 

void(* Wefts::s_cleanerPointer)(void *)
 

DWORD Wefts::s_tlsThreadObj = TLS_OUT_OF_INDEXES
 


Generated on Sat Mar 13 21:05:44 2004 for Wefts by doxygen 1.3.5