28 #ifndef _util_group_thread_h 29 #define _util_group_thread_h 35 #include <util/class/class.h> 50 virtual void lock() =0;
70 void unlock() {
if (locked_) { lock_->unlock(); locked_ =
false; } }
72 void lock() {
if (!locked_) { lock_->lock(); locked_ =
true; } }
84 static void *run_Thread_run(
void*thread);
87 virtual void run() =0;
105 virtual void add_thread(
int threadnum,
Thread* thread);
109 virtual void add_thread(
int threadnum,
Thread* thread,
int priority);
113 void delete_threads();
117 virtual int start_threads() =0;
120 virtual int wait_threads() =0;
128 virtual ThreadGrp* clone(
int nthread = -1);
131 static ThreadGrp * get_default_threadgrp();
132 static ThreadGrp * initial_threadgrp(
int &argc,
char ** argv);
157 void *Thread__run_Thread_run(
void*thread);
virtual void lock()=0
Obtain the lock.
void unlock()
Release the lock before the DTOR is called, if it is still held.
Definition: thread.h:70
virtual void unlock()=0
Release the lock.
The Thread abstract class defines an interface which must be implemented by classes wishing to be run...
Definition: thread.h:79
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:244
The base class for all reference counted objects.
Definition: ref.h:194
A template class that maintains references counts.
Definition: ref.h:332
ThreadLockHolder(const Ref< ThreadLock > &l)
Acquires the lock.
Definition: thread.h:65
~ThreadLockHolder()
Releases the lock if it is still held.
Definition: thread.h:74
The ThreadGrp abstract class provides a means to manage separate threads of control.
Definition: thread.h:92
The ThreadLock abstract class provides mutex locks to be used in conjunction with ThreadGrp's...
Definition: thread.h:44
void lock()
Acquire the lock once more.
Definition: thread.h:72
The ProcThreadGrp class privides a concrete thread group appropriate for an environment where there i...
Definition: thread.h:139
Acquire a lock on creation and release it on destruction.
Definition: thread.h:60
int nthread() const
The number of threads that will be run by start_thread.
Definition: thread.h:111