Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

  1. #ifndef _WORKERINC_H_
  2. #define _WORKERINC_H_
  3. //
  4. // EXTERN GLOBAL DECLARATIONS OF WORKER.C
  5. //
  6. extern LARGE_INTEGER ThreadIdleTO;
  7. extern CONST LARGE_INTEGER WorkQueueTO;
  8. extern LONG ThreadCount;
  9. extern LONG ThreadsWaiting;
  10. extern LONG MinThreads;
  11. extern HANDLE WorkQueuePort;
  12. extern HANDLE WorkQueueTimer;
  13. extern LIST_ENTRY AlertableWorkQueue ;
  14. extern CRITICAL_SECTION AlertableWorkQueueLock ;
  15. extern HANDLE AlertableWorkerHeap ;
  16. extern HANDLE AlertableThreadSemaphore;
  17. extern LONG AlertableThreadCount;
  18. #define WORKERS_NOT_INITIALIZED 0
  19. #define WORKERS_INITIALIZING -1
  20. #define WORKERS_INITIALIZED 1
  21. extern volatile LONG WorkersInitialized;
  22. #define ENTER_WORKER_API ( \
  23. (InterlockedCompareExchange ( \
  24. (PLONG)&WorkersInitialized, \
  25. WORKERS_INITIALIZING, \
  26. WORKERS_NOT_INITIALIZED)==WORKERS_NOT_INITIALIZED) \
  27. ? (InitializeWorkerThread(WORKERS_NOT_INITIALIZED)==WORKERS_INITIALIZED) \
  28. : ((WorkersInitialized==WORKERS_INITIALIZED) \
  29. ? TRUE \
  30. : InitializeWorkerThread(WORKERS_INITIALIZING)) \
  31. )
  32. LONG
  33. InitializeWorkerThread (
  34. LONG initFlags
  35. );
  36. DWORD APIENTRY
  37. WorkerThread (
  38. LPVOID param
  39. );
  40. struct WorkItem {
  41. LIST_ENTRY WI_List ; // link to next and prev element
  42. WORKERFUNCTION WI_Function ; // function to call
  43. PVOID WI_Context ; // context passed into function call
  44. } ;
  45. typedef struct WorkItem WorkItem ;
  46. DWORD APIENTRY
  47. WorkerThread (
  48. LPVOID param
  49. );
  50. #endif //_WORKERINC_H_