37 #include "dcmtk/config/osconfig.h"
38 #include "dcmtk/ofstd/oftypes.h"
39 #include "dcmtk/ofstd/ofstring.h"
48 unsigned int __stdcall thread_stub(
void *arg);
50 void *thread_stub(
void *arg);
124 OFBool
equal(
unsigned long tID);
157 static unsigned long self();
168 virtual void run() = 0;
170 #ifdef HAVE_WINDOWS_H
172 unsigned long theThreadHandle;
176 #ifdef HAVE_POINTER_TYPE_PTHREAD_T
189 #ifdef HAVE_WINDOWS_H
190 friend unsigned int __stdcall
thread_stub(
void *arg);
229 int set(
void *value);
237 int get(
void *&value);
249 #ifdef HAVE_CXX_VOLATILE
267 #ifndef _DARWIN_C_SOURCE
329 #ifdef HAVE_CXX_VOLATILE
342 #endif // _DARWIN_C_SOURCE
407 #ifdef HAVE_CXX_VOLATILE
497 #ifdef HAVE_CXX_VOLATILE
OFBool initialized() const
checks whether creation of the object was successful.
int wrlock()
gets a write lock.
int wait()
blocks the calling thread until the semaphore counter is greater than zero and then atomically decrea...
int trylock()
tries to lock the mutex object.
int trywrlock()
trys to get a write lock.
int set(void *value)
sets the thread specific value for this object.
OFBool locked
did we sucessfully lock the lock?
static const int busy
this constant is returned by the trylock() method if the mutex is already locked. ...
int unlock()
releases the lock on the mutex object.
OFReadWriteLock & theLock
the lock on which we are operating
static const int busy
this constant is returned by the tryrdlock() and trywrlock() methods if the read/write lock is alread...
static void errorstr(OFString &description, int code)
converts any of the error codes returned by the methods of this class into a textual description...
OFThread()
default constructor.
OFReadWriteLocker & operator=(const OFReadWriteLocker &arg)
unimplemented private assignment operator
int trywait()
atomically decreases the counter if it is larger than zero, otherwise returns OFSemaphore::busy.
void * theKey
thread specific data key resource
OFSemaphore & operator=(const OFSemaphore &arg)
unimplemented private assignment operator
OFBool initialized() const
checks whether creation of the object was successful.
static void errorstr(OFString &description, int code)
converts any of the error codes returned by the methods of this class into a textual description...
OFReadWriteLocker(OFReadWriteLock &lock)
constructor
static void thread_exit()
terminates the calling thread, in a similar way that exit() terminates the calling process...
OFThreadSpecificData()
default constructor
provides an operating system independent abstraction for semaphores.
OFReadWriteLock()
default constructor
OFMutex()
default constructor
int post()
atomically increases the counter.
static const int busy
this constant is returned by the join() method if another thread is already waiting for termination o...
int join()
blocks the calling thread until the thread referenced by the OFThread object terminates.
~OFReadWriteLocker()
destructor, unlocks the mutex if necessary
friend void * thread_stub(void *arg)
thread stub must be friend to call run()
void * theLock
read/write lock resource
OFThread & operator=(const OFThread &arg)
unimplemented private assignment operator
int unlock()
unlocks the read/write lock.
int rdlock()
gets a read lock.
This class aims to provide an easy way for making sure OFReadWriteLocks are unlocked in an exception ...
virtual ~OFThread()
destructor.
virtual void run()=0
this method implements the thread that is run by calling the start method of the OFThread object...
static void errorstr(OFString &description, int code)
converts any of the error codes returned by the methods of this class into a textual description...
~OFReadWriteLock()
destructor
OFBool equal(unsigned long tID)
checks if the given thread ID matches the thread ID of the thread referenced by this object...
provides an operating system independent abstraction for mutexes (mutual exclusion locks)...
provides an operating system independent abstraction for thread specific data.
OFBool initialized() const
checks whether creation of the object was successful.
int tryrdlock()
try to lock the lock for reading
int rdlock()
lock the lock for reading
int trywrlock()
try to lock the lock for writing
static void errorstr(OFString &description, int code)
converts any of the error codes returned by the methods of this class into a textual description...
void * theMutex
mutex resource
int start()
adds a new thread of control to the current process.
OFSemaphore(unsigned int numResources)
constructor.
static const int busy
this constant is returned by the trywait() method if the semaphore is already locked.
OFReadWriteLock & operator=(const OFReadWriteLock &arg)
unimplemented private assignment operator
~OFThreadSpecificData()
destructor.
OFThreadSpecificData & operator=(const OFThreadSpecificData &arg)
unimplemented private assignment operator
provides an operating system independent abstraction for threads.
int unlock()
unlock the lock
OFMutex & operator=(const OFMutex &arg)
unimplemented private assignment operator
a simple string class that implements a subset of std::string.
provides an operating system independent abstraction for read/write locks.
int tryrdlock()
trys to get a read lock.
unsigned long threadID()
returns the thread identifier of the thread referenced by the OFThread object, if the thread has alre...
static void errorstr(OFString &description, int code)
converts any of the error codes returned by the methods of this class into a textual description...
void * theSemaphore
semaphore resource
unsigned long theThread
thread identifier
OFBool initialized() const
checks whether creation of the object was successful.
int wrlock()
lock the lock for writing
int lock()
locks the mutex object.