threads.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Portions created by Alan Antonuk are Copyright (c) 2013-2014 Alan Antonuk.
  3. * All Rights Reserved.
  4. *
  5. * Portions created by Michael Steinert are Copyright (c) 2012-2013 Michael
  6. * Steinert. All Rights Reserved.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a
  9. * copy of this software and associated documentation files (the "Software"),
  10. * to deal in the Software without restriction, including without limitation
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12. * and/or sell copies of the Software, and to permit persons to whom the
  13. * Software is furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  23. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  24. * DEALINGS IN THE SOFTWARE.
  25. */
  26. #ifndef AMQP_THREAD_H
  27. #define AMQP_THREAD_H
  28. #if !defined(WINVER) || defined(__MINGW32__) || defined(__MINGW64__)
  29. #ifdef WINVER
  30. #undef WINVER
  31. #endif
  32. /* Windows Vista or newer */
  33. #define WINVER 0x0600
  34. #endif
  35. #ifndef WIN32_LEAN_AND_MEAN
  36. #define WIN32_LEAN_AND_MEAN
  37. #endif
  38. #include <windows.h>
  39. typedef SRWLOCK pthread_mutex_t;
  40. #define PTHREAD_MUTEX_INITIALIZER SRWLOCK_INIT;
  41. DWORD pthread_self(void);
  42. int pthread_mutex_init(pthread_mutex_t *, void *attr);
  43. int pthread_mutex_lock(pthread_mutex_t *);
  44. int pthread_mutex_unlock(pthread_mutex_t *);
  45. int pthread_mutex_destroy(pthread_mutex_t *);
  46. #endif /* AMQP_THREAD_H */