Source code of Windows XP (NT5)
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.

81 lines
3.4 KiB

  1. //================================================================================
  2. // Microsoft Confidential.
  3. // Copyright (C) Microsoft 1997.
  4. //
  5. // Author: RameshV
  6. //================================================================================
  7. #ifndef ADT_H_INCLUDED
  8. #define ADT_H_INCLUDED
  9. //================================================================================
  10. // Required headers
  11. //================================================================================
  12. #include <winbase.h> // Semaphores and wait functions
  13. //================================================================================
  14. // Some Data type implementations. EXPORTED
  15. //================================================================================
  16. typedef struct st_prodcons { // structure for producer-consumer sychro.
  17. HANDLE ProducerSemaphore; // Semaphore for tracking producers
  18. HANDLE ConsumerSemaphore; // Semaphore for tracking consumers
  19. DWORD MaxProducers; // Maximum # of producers
  20. DWORD MaxConsumers; // Maximum # of consumers
  21. DWORD Flags; // Options -- Unused?
  22. } PRODCONS, *PPRODCONS;
  23. //================================================================================
  24. // Function headers of EXPORTED functions
  25. //================================================================================
  26. DWORD // Win32 Errors
  27. InitializeProducerConsumer( // Initialize the pointer
  28. OUT PPRODCONS Synch, // The memory must be pre-allocated
  29. IN DWORD MaxProducers, // Total # of simultaneous producers
  30. IN DWORD MaxConsumers // Totat # of consumers
  31. );
  32. VOID
  33. DestroyProducerConsumer( // Destroy and free up resources
  34. IN PPRODCONS Synch // The producer consumer object
  35. );
  36. DWORD // Win32 errors
  37. StartProducerEx( // See StartProdConsExInternal
  38. IN PPRODCONS Synch, // Syncho. object
  39. IN DWORD TimeOutMilliSec,// Timeout for wait in milliseconds
  40. IN BOOL Alertable // Is the wait alertable?
  41. );
  42. DWORD // Win32 errors
  43. StartConsumerEx( // See StartProdConsExInternal
  44. IN PPRODCONS Synch, // Syncho. object
  45. IN DWORD TimeOutMilliSec,// Timeout for wait in milliseconds
  46. IN BOOL Alertable // Is the wait alertable?
  47. );
  48. DWORD // Win32 errors
  49. StartProducer( // Wait until a producer can start
  50. IN PPRODCONS Synch // The synch object
  51. );
  52. DWORD // Win32 errors
  53. StartConsumer( // Wait until a consumer can start
  54. IN PPRODCONS Synch // The synch object
  55. );
  56. DWORD // Win32 Errors
  57. EndProducer( // See EndProdConsExInternal
  58. IN PPRODCONS Synch // Synch object
  59. );
  60. DWORD // Win32 errors
  61. EndConsumer( // See EndProdConsExInternal
  62. IN PPRODCONS Synch // Synch object
  63. );
  64. //================================================================================
  65. // End of file
  66. //================================================================================
  67. #endif ADT_H_INCLUDED