• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/util/header/Thread.h

Go to the documentation of this file.
00001 
00002 typedef ulong (__stdcall* Function)(void*);
00003 // Thread Definitions
00004 #define THREADFUNCTION(__funcname, __input) ulong __stdcall __funcname(void* __input)
00005 #define RETURN(_value) return (ulong)_value
00006 
00009 class Thread {
00010 public:
00011         Thread();
00012         Thread(const Thread&);
00013         virtual ~Thread() {}
00014         bool start(Function, void* param = 0, uint stacksize = 512, int priority = 0);
00015         bool end(void);
00016         bool valid(void);
00017 private:
00018         HANDLE thread;
00019 };
00020 
00021 typedef Thread* pThread;
00022 
00024 class Section {
00025 public:
00026         Section();
00027         Section(const Section&);
00028         virtual ~Section() {}
00029         void init(void);
00030         void uninit(void);
00031         bool tryenter(void);
00032         void enter(void);
00033         void leave(void);
00034 private:
00035         CRITICAL_SECTION section;
00036 };
00037 
00038 typedef Section* pSection;
00039 
00042 inline void wait(unsigned long milsec){Sleep(milsec);}

Generated on Fri Jun 18 2010 17:48:40 for Cannonball by  doxygen 1.7.0