Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# Thread.h

    00001 #ifndef STK_THREAD_H
    00002 #define STK_THREAD_H
    00003
    00004 #include "Stk.h"
    00005
    00006 #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
    00007
    00008   #include <pthread.h>
    00009   #define THREAD_TYPE
    00010   typedef pthread_t THREAD_HANDLE;
    00011   typedef void * THREAD_RETURN;
    00012   typedef void * (*THREAD_FUNCTION)(void *);
    00013
    00014 #elif defined(__OS_WINDOWS__)
    00015
    00016   #include <windows.h>
    00017   #include <process.h>
    00018   #define THREAD_TYPE __stdcall
    00019   typedef unsigned long THREAD_HANDLE;
    00020   typedef unsigned THREAD_RETURN;
    00021   typedef unsigned (__stdcall *THREAD_FUNCTION)(void *);
    00022
    00023 #endif
    00024
    00025 namespace stk {
    00026
    00027 /***************************************************/
    00047 /***************************************************/
    00048
    00049 class Thread : public Stk
    00050 {
    00051  public:
    00053   Thread();
    00054
    00056   ~Thread();
    00057
    00059
    00064   bool start( THREAD_FUNCTION routine, void * ptr = NULL );
    00065
    00067
    00074   bool cancel(void);
    00075
    00077
    00080   bool wait(void);
    00081
    00083
    00088   void testCancel(void);
    00089
    00090  protected:
    00091
    00092   THREAD_HANDLE thread_;
    00093
    00094 };
    00095
    00096 } // stk namespace
    00097
    00098 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.