ifndef HUSH_THREAD_H define HUSH_THREAD_H // thread.h // simple thread package, based on solaris threads // September, October 1995 // Bastiaan Sch\"onhage // options for the constructor include: // bound: this thread will be bound on a specific LWP (slow) // detached: this thread cannot be joined; resources are freed on exit // daemon: mark this thread as a daemon thread, will be killed if ... ifndef _REENTRANT define _REENTRANT endif include <hush/export.h>
class thread { public: thread( char* options = "" ); // constructor and virtual ~thread() {};
// destructor of thread object virtual int main(); // will be called at start of thread // methods on this thread class int run(); // start the thread void kill(); // kill this thread void suspend(); // suspend until continue void resume(); // continue the suspended thread int priority(); // returns the priority of this thread void priority(int pri); // set the priority unsigned id(); // give thread id void exit(int status = 0 ); // exit current running thread ?? AE // methods on current running thread protected: unsigned self(); // returns thread id of current thread void yield(); // yield execution to another thread virtual void error( char* s = "" ); // this function will be // called on error public: // general methods for threads void setconcurrency(int n = 2); // set nr of concurrent threads // wait till completion of a specific thread, or of any (waitfor=0) static unsigned join( unsigned waitfor = 0, void* status = 0 ); private: static void* act; unsigned t; int opt; };
endif
Hush Online Technology
hush@cs.vu.nl
09/09/98 |
![]() |
![]() |