home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Snippets / Threads Interface / CThread.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-03  |  891 b   |  37 lines  |  [TEXT/KAHL]

  1. /***
  2.  * CThread.h
  3.  *
  4.  *  Abstract class to implement a thread.
  5.  *        Copyright © Gordon Watts 1994 (gwatts@fnal.fnal.gov)
  6.  *
  7.  ***/
  8. #pragma once
  9.  
  10. #include "CMainThread.h"
  11. #include <Threads.h>
  12.  
  13. /** Errors **/
  14. #define errCouldNotMakeThread 500
  15.  
  16. class CThread : public CMainThread {
  17. protected:
  18.     ThreadOptions    theOptions;
  19.     Size            theStackSize;
  20.     Boolean            recycleThread;
  21.     Boolean            deleteWhenDone;
  22.  
  23.     void            ThreadRoutine (void);            /* Method to be called in the thread */
  24.     static pascal void
  25.                     *ThreadExtProc (void *param);    /* External thread procedure called */
  26.  
  27. public:
  28.                     CThread (void);
  29.                     ~CThread (void);                /* Delete, kill off this thread too if running */
  30.  
  31.     void            Start (void);                    /* Start up the thread */
  32.     void            Kill (void);                    /* Kill off a thread */
  33.  
  34.     void            DeleteOnFinish (Boolean doIt);    /* Release obj when done? */
  35.  
  36.     void            Sleep (void);                    /* Put ourselves to sleep */
  37. };