home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-13 | 1.3 KB | 69 lines | [TEXT/CWIE] |
- // Sprocket Framework header file
- // ThreadContext.h
-
-
- #ifndef _THREADCONTEXT_
- #define _THREADCONTEXT_
-
- #ifndef __THREADS__
- #include <Threads.h>
- #endif
-
- #ifdef __MWERKS__
-
- // set to a non-zero value to get profiling functions
- #ifndef CW_THREAD_PROFILE
- #define CW_THREAD_PROFILE 0
- #endif
-
- #if __MWERKS__ >= 0x0800
- #define CW7_EXCEPTIONS 0
- #else
- #define CW7_EXCEPTIONS 1
- #endif
-
- #if !THREAD_ZEROOVERHEAD_EXCEPTIONS
- #include <MWException.h>
- #endif
-
- #endif
-
-
-
- class TThreadContext
- {
- protected:
- ThreadID fThreadID;
- void* fThreadResult;
-
- #if !GENERATINGCFM
- long fSavedA5;
- #endif
-
- #if CW_THREAD_PROFILE
- ProfilerRefT fProfilerRef; // Profiler context
- #endif
-
- #if CW7_EXCEPTIONS
- ExceptionState fExceptionState;
- char fCatchBuffer[CATCH_BUFSIZE];
- #endif
-
- public:
- TThreadContext(void);
- virtual ~TThreadContext();
-
- virtual void CreateThread(ThreadStyle threadStyle, ThreadEntryProcPtr threadEntry, Size stackSize, ThreadOptions options);
-
- virtual void SwitchIn(void);
- virtual void SwitchOut(void);
- virtual void Terminate(void);
-
- protected:
- static pascal void SwitchInProc(ThreadID threadBeingSwitched, void *switchProcParam);
- static pascal void SwitchOutProc(ThreadID threadBeingSwitched, void *switchProcParam);
- static pascal void TerminationProc(ThreadID threadTerminated, void *terminationProcParam);
- };
-
- #endif
-