home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 November / VPR9611B.ISO / vabasic / ntclnt.exe / DISK8 / data.8 / datab / INCLUDE / VTHREAD.HH < prev    next >
Text File  |  1996-07-29  |  4KB  |  112 lines

  1. //==========================================================================//
  2. //     $Source: /rcs/crcs/general/vthread.hh,v $
  3. //     Checked in by: $Author: ej1 $
  4. //     $Date: 1996/06/10 21:32:23 $
  5. //     $Revision: 1.3 $
  6. //--------------------------------------------------------------------------//
  7. //                                            //
  8. //         Copyright (c) 1995, Visual Edge Software Ltd.                //
  9. //                                        //
  10. //     All rights reserved.  This notice is  intended  as  a  precaution    //
  11. //     against    inadvertent publication, and shall not be deemed to con-    //
  12. //     stitute an acknowledgment that publication has  occurred     nor  to    //
  13. //     imply  any  waiver  of confidentiality.    The year included in the    //
  14. //     notice is the year of the creation of the work.                //
  15. //                                        //
  16. //----------------------------------------------------------------------------
  17. // DESCRIPTION:                                                             
  18. //
  19. //==========================================================================//
  20.  
  21. #ifndef VTHREAD_HH
  22. #define VTHREAD_HH
  23.  
  24. #include <visedge.hh>
  25. #include <dllclass.hh>
  26. #include <status.hh>
  27.  
  28. VCLASS VeThread;
  29.  
  30. //=========================================================================
  31. // VTThreadFunction
  32. // This type is a function pointer to a thread's function
  33. //-------------------------------------------------------------------------
  34. typedef void VFUNCPTR(VTThreadFunction)(VeThread *, void *);
  35.  
  36. //=========================================================================
  37. // VTThreadState
  38. // This enumeration is used to define the state of a thread
  39. //-------------------------------------------------------------------------
  40. typedef enum VTThreadStateEnum
  41. {
  42.     kVThreadRunning,    // The thread is in execution
  43.     kVThreadSuspended,    // The thread is suspended an 
  44.                 //  waiting for a condition to append
  45.     kVThreadStopped,    // The thread has finished execution
  46.     kVThreadStopping    // Internal type 
  47.             
  48. } VTThreadState;
  49.  
  50. //=========================================================================
  51. // VTThreadPriority
  52. // This enumeration is used to define the differents priorities of a thread
  53. //-------------------------------------------------------------------------
  54. typedef enum VTThreadPriorityEnum
  55. {
  56.     kVPriorityLow,
  57.     kVPriorityNormal,
  58.     kVPriorityHigh,
  59.     kVPriorityVeryHigh,  
  60.     kVPriorityError  
  61.             
  62. } VTThreadPriority;
  63.  
  64. //=========================================================================
  65. //Include the files corresponding to the plateform
  66. //-------------------------------------------------------------------------
  67. #if defined(VSYS_WIN32) && defined(VSYS_MT)
  68. //For Windows 32
  69. #include "ntmt.hh"
  70.  
  71. #elif defined(VSYS_SOLARIS) && defined(VSYS_MT)
  72. //For SunOs
  73. #include "sunmt.hh"
  74.  
  75. #else 
  76. //Dummy classes with no MT support
  77. #include "nomt.hh"
  78. #endif
  79.  
  80. //=========================================================================
  81. // Macros for using locks
  82. //-------------------------------------------------------------------------
  83. #define VETOKEN_CONCAT(a, b)    a ## b
  84. #define VETOKEN_PASS(a, b)      VETOKEN_CONCAT(a, b)
  85. #define VEUNIQUE_TOKEN(base)    VETOKEN_PASS(base, __LINE__)
  86. #define VEAUTONAME              VEUNIQUE_TOKEN(__autolock)
  87.  
  88. #ifdef VSYS_MT
  89.     #define VELOCK
  90.     #define VELOCKDECL(name)        VeLock name
  91.     #define VEEXTERNLOCKDECL(name)  VDATADECL(VeLock) name
  92.     #define VEEXTERNLOCKDEF(name)   VDATADEF(VeLock) name
  93.     #define VESTATICLOCKDECL(name)  static VeLock name
  94.  
  95.     #define VEAUTOLOCK(lock)    VeAutoLock VEAUTONAME(lock)
  96. #else
  97.     #define VENOOP()        extern int VeNoOp
  98.  
  99.     #define VELOCKDECL(name)    VENOOP()
  100.     #define VEEXTERNLOCKDECL(name)    VENOOP()
  101.     #define VEEXTERNLOCKDEF(name)   VENOOP()
  102.     #define VESTATICLOCKDECL(name)    VENOOP()
  103.  
  104.     #define VEAUTOLOCK(lock)    VENOOP()
  105. #endif
  106.  
  107. #define VELOCK_BEGIN(lock) { VEAUTOLOCK(lock);
  108. #define VELOCK_END          }
  109.  
  110. #endif    // VTHREAD_HH
  111.  
  112.