15 #include <sys/types.h> 25 static void SleepMs(
int TimeoutMs);
31 bool Wait(
int TimeoutMs = 0);
49 bool TimedWait(
cMutex &Mutex,
int TimeoutMs);
57 cRwLock(
bool PreferWriter =
false);
59 bool Lock(
bool Write,
int TimeoutMs = 0);
88 static void *StartThread(
cThread *Thread);
90 void SetPriority(
int Priority);
91 void SetIOPriority(
int Priority);
94 virtual void Action(
void) = 0;
102 void Cancel(
int WaitSeconds = 0);
110 cThread(
const char *Description = NULL,
bool LowPriority =
false);
118 void SetDescription(
const char *Description, ...) __attribute__ ((format (printf, 2, 3)));
130 static void SetMainThreadId(
void);
165 #define LOCK_THREAD cThreadLock ThreadLock(this) 185 static bool Engaged(
void);
199 operator FILE* () {
return f; }
200 bool Open(
const char *Command,
const char *Mode);
209 int SystemExec(
const char *Command,
bool Detached =
false);
bool Active(void)
Returns true if this I/O throttling object is currently active.
void Signal(void)
Signals a caller of Wait() that the condition it is waiting for is met.
static tThreadId IsMainThread(void)
static void SleepMs(int TimeoutMs)
Creates a cCondWait object and uses it to sleep for TimeoutMs milliseconds, immediately giving up the...
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
bool Wait(int TimeoutMs=0)
Waits at most TimeoutMs milliseconds for a call to Signal(), or forever if TimeoutMs is 0...
int SystemExec(const char *Command, bool Detached=false)
static tThreadId mainThreadId