Team Fortress 2 Source Code as on 22/4/2020
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.

37 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include "CompletionEvent.h"
  8. #include "winlite.h"
  9. //-----------------------------------------------------------------------------
  10. // Purpose: creates an event
  11. //-----------------------------------------------------------------------------
  12. EventHandle_t Event_CreateEvent()
  13. {
  14. return (EventHandle_t)::CreateEvent(NULL, false, false, NULL);
  15. }
  16. //-----------------------------------------------------------------------------
  17. // Purpose: sets the current thread to wait for either the event to be signalled, or the timeout to occur
  18. //-----------------------------------------------------------------------------
  19. void Event_WaitForEvent(EventHandle_t event, unsigned long timeoutMilliseconds)
  20. {
  21. ::WaitForSingleObject((HANDLE)event, timeoutMilliseconds);
  22. }
  23. //-----------------------------------------------------------------------------
  24. // Purpose: signals an event to Activate
  25. // Releases one thread waiting on the event.
  26. // If the event has no threads waiting on it, the next thread to wait on it will be let right through
  27. //-----------------------------------------------------------------------------
  28. void Event_SignalEvent(EventHandle_t event)
  29. {
  30. ::SetEvent((HANDLE)event);
  31. }