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.

149 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. wakeupsem.c
  5. Abstract:
  6. Contains functions for creating and deleting Events on which the
  7. messenger threads will wait. The events get set if either data is
  8. received, or a new name is added to the name table. These routines
  9. were originally written for OS/2 semaphores.
  10. Contains:
  11. CreateWakeupSems
  12. CloseWakeupSems
  13. Author:
  14. Dan Lafferty (danl) 25-Jun-1991
  15. Environment:
  16. User Mode - Win32
  17. Revision History:
  18. 25-Jun-1991 danl
  19. Ported from LM2.0
  20. --*/
  21. #include "msrv.h"
  22. #include "msgdbg.h" // MSG_LOG
  23. #include <netlib.h> // UNUSED macro
  24. #include "msgdata.h"
  25. BOOL
  26. MsgCreateWakeupEvent(
  27. void
  28. )
  29. /*++
  30. Routine Description:
  31. There is now one master event that is shared by everything. Create it.
  32. Arguments:
  33. None
  34. Return Value:
  35. None
  36. --*/
  37. {
  38. //
  39. // Create event
  40. //
  41. wakeupEvent = CreateEvent(
  42. NULL, // Event Attributes
  43. FALSE, // ManualReset (auto-reset selected)
  44. TRUE, // Initial State(signaled)
  45. NULL); // Name
  46. if (wakeupEvent == NULL) {
  47. MSG_LOG(ERROR, "CreateWakeupSems:CreateEvent: FAILURE %X\n",
  48. GetLastError());
  49. return(FALSE);
  50. }
  51. return (wakeupEvent != NULL );
  52. }
  53. VOID
  54. MsgCloseWakeupEvent(
  55. void
  56. )
  57. /*++
  58. Routine Description:
  59. Release the master event.
  60. Arguments:
  61. None
  62. Return Value:
  63. None
  64. --*/
  65. {
  66. CLOSE_HANDLE(wakeupEvent, NULL);
  67. }
  68. BOOL
  69. MsgCreateWakeupSems(
  70. DWORD NumNets
  71. )
  72. /*++
  73. Routine Description:
  74. This routine fills in the WakeupSem array with event handles for
  75. each net. All nets share the same event handle, so when the handle
  76. becomes signalled, the NCB array for each net needs to be examined.
  77. Arguments:
  78. Return Value:
  79. Note:
  80. --*/
  81. {
  82. DWORD i;
  83. for ( i = 0; i < NumNets; i++ ) // One per net + one group
  84. {
  85. wakeupSem[i] = wakeupEvent;
  86. }
  87. return TRUE;
  88. }
  89. VOID
  90. MsgCloseWakeupSems()
  91. {
  92. // Noop
  93. }