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.

48 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "system_wrappers/include/event_wrapper.h"
  11. #if defined(_WIN32)
  12. #include <windows.h>
  13. #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
  14. #include <ApplicationServices/ApplicationServices.h>
  15. #endif
  16. #include "rtc_base/event.h"
  17. namespace webrtc {
  18. class EventWrapperImpl : public EventWrapper {
  19. public:
  20. ~EventWrapperImpl() override {}
  21. bool Set() override {
  22. event_.Set();
  23. return true;
  24. }
  25. EventTypeWrapper Wait(unsigned long max_time) override {
  26. int to_wait = max_time == WEBRTC_EVENT_INFINITE
  27. ? rtc::Event::kForever
  28. : static_cast<int>(max_time);
  29. return event_.Wait(to_wait) ? kEventSignaled : kEventTimeout;
  30. }
  31. private:
  32. rtc::Event event_;
  33. };
  34. // static
  35. EventWrapper* EventWrapper::Create() {
  36. return new EventWrapperImpl();
  37. }
  38. } // namespace webrtc