compat_mutex_winthreads.c 699 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright (c) 2003-2004, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. #include "lib/lock/compat_mutex.h"
  6. void
  7. tor_locking_init(void)
  8. {
  9. }
  10. void
  11. tor_mutex_init(tor_mutex_t *m)
  12. {
  13. InitializeCriticalSection(&m->mutex);
  14. }
  15. void
  16. tor_mutex_init_nonrecursive(tor_mutex_t *m)
  17. {
  18. InitializeCriticalSection(&m->mutex);
  19. }
  20. void
  21. tor_mutex_uninit(tor_mutex_t *m)
  22. {
  23. DeleteCriticalSection(&m->mutex);
  24. }
  25. void
  26. tor_mutex_acquire(tor_mutex_t *m)
  27. {
  28. raw_assert(m);
  29. EnterCriticalSection(&m->mutex);
  30. }
  31. void
  32. tor_mutex_release(tor_mutex_t *m)
  33. {
  34. LeaveCriticalSection(&m->mutex);
  35. }