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.

91 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. threads.h
  5. Abstract:
  6. Win32 version of NT wait/timer/thread pool functions
  7. Author:
  8. Richard L Firth (rfirth) 27-Feb-1998
  9. Notes:
  10. Original code from NT5/gurdeep
  11. Revision History:
  12. 27-Feb-1998 rfirth
  13. Created
  14. --*/
  15. //
  16. // manifests
  17. //
  18. #define TPS_IO_WORKER_SIGNATURE 0x49737054 // 'TpsI'
  19. #define TPS_WORKER_SIGNATURE 0x4B737054 // 'TpsK'
  20. #define TPS_TIMER_SIGNATURE 0x54737054 // 'TpsT'
  21. #define TPS_WAITER_SIGNATURE 0x57577054 // 'TpsW'
  22. #define MAX_WAITS 64
  23. //
  24. // global data
  25. //
  26. EXTERN_C BOOL g_bDllTerminating;
  27. extern BOOL g_bTpsTerminating;
  28. extern DWORD g_ActiveRequests;
  29. //
  30. // prototypes for internal functions
  31. //
  32. VOID
  33. TerminateTimers(
  34. VOID
  35. );
  36. VOID
  37. TerminateWaiters(
  38. VOID
  39. );
  40. VOID
  41. TerminateWorkers(
  42. VOID
  43. );
  44. //
  45. // Prototypes for thread pool private functions
  46. //
  47. DWORD
  48. StartThread(
  49. IN LPTHREAD_START_ROUTINE pfnFunction,
  50. OUT PHANDLE phThread,
  51. IN BOOL fSynchronize
  52. );
  53. DWORD
  54. TpsEnter(
  55. VOID
  56. );
  57. #define TpsLeave() \
  58. ASSERT( 0 != g_ActiveRequests ); InterlockedDecrement((LPLONG)&g_ActiveRequests)
  59. VOID
  60. QueueNullFunc(
  61. IN HANDLE hThread
  62. );
  63. #define THREAD_TYPE_WORKER 1
  64. #define THREAD_TYPE_IO_WORKER 2