pthread_compat.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. Copyright (c) 2011-2016 mingw-w64 project
  3. Permission is hereby granted, free of charge, to any person obtaining a
  4. copy of this software and associated documentation files (the "Software"),
  5. to deal in the Software without restriction, including without limitation
  6. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7. and/or sell copies of the Software, and to permit persons to whom the
  8. Software is furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  16. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17. DEALINGS IN THE SOFTWARE.
  18. */
  19. /*
  20. * Parts of this library are derived by:
  21. *
  22. * Posix Threads library for Microsoft Windows
  23. *
  24. * Use at own risk, there is no implied warranty to this code.
  25. * It uses undocumented features of Microsoft Windows that can change
  26. * at any time in the future.
  27. *
  28. * (C) 2010 Lockless Inc.
  29. * All rights reserved.
  30. *
  31. * Redistribution and use in source and binary forms, with or without modification,
  32. * are permitted provided that the following conditions are met:
  33. *
  34. *
  35. * * Redistributions of source code must retain the above copyright notice,
  36. * this list of conditions and the following disclaimer.
  37. * * Redistributions in binary form must reproduce the above copyright notice,
  38. * this list of conditions and the following disclaimer in the documentation
  39. * and/or other materials provided with the distribution.
  40. * * Neither the name of Lockless Inc. nor the names of its contributors may be
  41. * used to endorse or promote products derived from this software without
  42. * specific prior written permission.
  43. *
  44. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AN
  45. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  46. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  47. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  48. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  49. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  51. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  52. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  53. * OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. #ifndef WIN_PTHREADS_PTHREAD_COMPAT_H
  56. #define WIN_PTHREADS_PTHREAD_COMPAT_H
  57. #ifdef __GNUC__
  58. #define WINPTHREADS_INLINE inline
  59. #define WINPTHREADS_ATTRIBUTE(X) __attribute__(X)
  60. #define WINPTHREADS_SECTION(X) __section__(X)
  61. #elif _MSC_VER
  62. #include "pthread_time.h"
  63. #ifdef _WIN64
  64. typedef __int64 pid_t;
  65. #else
  66. typedef int pid_t;
  67. #endif
  68. typedef int clockid_t;
  69. #define WINPTHREADS_INLINE __inline
  70. #define WINPTHREADS_ATTRIBUTE(X) __declspec X
  71. #define WINPTHREADS_SECTION(X) allocate(X)
  72. #endif
  73. #endif