noderb 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. data/ext/noderb_extension/libuv/AUTHORS +11 -1
  2. data/ext/noderb_extension/libuv/LICENSE +0 -8
  3. data/ext/noderb_extension/libuv/Makefile +5 -5
  4. data/ext/noderb_extension/libuv/README +11 -6
  5. data/ext/noderb_extension/libuv/common.gypi +158 -7
  6. data/ext/noderb_extension/libuv/config-unix.mk +34 -26
  7. data/ext/noderb_extension/libuv/gyp_uv +22 -4
  8. data/ext/noderb_extension/libuv/include/{eio.h → uv-private/eio.h} +2 -2
  9. data/ext/noderb_extension/libuv/include/{uv-unix.h → uv-private/uv-unix.h} +40 -0
  10. data/ext/noderb_extension/libuv/include/{uv-win.h → uv-private/uv-win.h} +96 -14
  11. data/ext/noderb_extension/libuv/include/uv.h +508 -83
  12. data/ext/noderb_extension/libuv/src/unix/cares.c +185 -0
  13. data/ext/noderb_extension/libuv/src/unix/core.c +828 -0
  14. data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_darwin.h +4 -0
  15. data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_linux.h +5 -15
  16. data/ext/noderb_extension/libuv/src/{eio → unix/eio}/eio.c +23 -2
  17. data/ext/noderb_extension/libuv/src/unix/error.c +102 -0
  18. data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_linux.h +26 -15
  19. data/ext/noderb_extension/libuv/src/unix/fs.c +562 -0
  20. data/ext/noderb_extension/libuv/src/unix/internal.h +75 -0
  21. data/ext/noderb_extension/libuv/src/unix/pipe.c +282 -0
  22. data/ext/noderb_extension/libuv/src/unix/process.c +287 -0
  23. data/ext/noderb_extension/libuv/src/unix/stream.c +727 -0
  24. data/ext/noderb_extension/libuv/src/unix/tcp.c +226 -0
  25. data/ext/noderb_extension/libuv/src/unix/udp.c +524 -0
  26. data/ext/noderb_extension/libuv/src/{uv-eio.c → unix/uv-eio.c} +48 -27
  27. data/ext/noderb_extension/libuv/src/{uv-eio.h → unix/uv-eio.h} +1 -1
  28. data/ext/noderb_extension/libuv/src/uv-common.c +24 -14
  29. data/ext/noderb_extension/libuv/src/uv-common.h +12 -7
  30. data/ext/noderb_extension/libuv/src/win/async.c +14 -16
  31. data/ext/noderb_extension/libuv/src/win/cares.c +64 -79
  32. data/ext/noderb_extension/libuv/src/win/core.c +105 -53
  33. data/ext/noderb_extension/libuv/src/win/error.c +23 -13
  34. data/ext/noderb_extension/libuv/src/win/fs.c +807 -0
  35. data/ext/noderb_extension/libuv/src/win/getaddrinfo.c +61 -41
  36. data/ext/noderb_extension/libuv/src/win/handle.c +56 -30
  37. data/ext/noderb_extension/libuv/src/win/internal.h +134 -95
  38. data/ext/noderb_extension/libuv/src/win/loop-watcher.c +21 -18
  39. data/ext/noderb_extension/libuv/src/win/pipe.c +313 -158
  40. data/ext/noderb_extension/libuv/src/win/process.c +117 -131
  41. data/ext/noderb_extension/libuv/src/win/req.c +55 -31
  42. data/ext/noderb_extension/libuv/src/win/stdio.c +5 -5
  43. data/ext/noderb_extension/libuv/src/win/stream.c +19 -14
  44. data/ext/noderb_extension/libuv/src/win/tcp.c +278 -336
  45. data/ext/noderb_extension/libuv/src/win/threadpool.c +73 -0
  46. data/ext/noderb_extension/libuv/src/win/timer.c +44 -37
  47. data/ext/noderb_extension/libuv/src/win/udp.c +592 -0
  48. data/ext/noderb_extension/libuv/src/win/util.c +20 -6
  49. data/ext/noderb_extension/libuv/src/win/winapi.c +23 -6
  50. data/ext/noderb_extension/libuv/src/win/winapi.h +4206 -0
  51. data/ext/noderb_extension/libuv/src/win/winsock.c +270 -0
  52. data/ext/noderb_extension/libuv/src/win/winsock.h +134 -0
  53. data/ext/noderb_extension/libuv/test/benchmark-ares.c +10 -6
  54. data/ext/noderb_extension/libuv/test/benchmark-getaddrinfo.c +10 -7
  55. data/ext/noderb_extension/libuv/test/benchmark-list.h +21 -0
  56. data/ext/noderb_extension/libuv/test/benchmark-ping-pongs.c +11 -7
  57. data/ext/noderb_extension/libuv/test/benchmark-pound.c +147 -58
  58. data/ext/noderb_extension/libuv/test/benchmark-pump.c +29 -23
  59. data/ext/noderb_extension/libuv/test/benchmark-spawn.c +13 -10
  60. data/ext/noderb_extension/libuv/test/benchmark-udp-packet-storm.c +250 -0
  61. data/ext/noderb_extension/libuv/test/dns-server.c +11 -6
  62. data/ext/noderb_extension/libuv/test/echo-server.c +30 -22
  63. data/ext/noderb_extension/libuv/test/test-async.c +3 -3
  64. data/ext/noderb_extension/libuv/test/test-callback-stack.c +6 -6
  65. data/ext/noderb_extension/libuv/test/test-connection-fail.c +6 -5
  66. data/ext/noderb_extension/libuv/test/test-delayed-accept.c +13 -13
  67. data/ext/noderb_extension/libuv/test/test-fs.c +715 -0
  68. data/ext/noderb_extension/libuv/test/test-getaddrinfo.c +11 -8
  69. data/ext/noderb_extension/libuv/test/test-gethostbyname.c +8 -9
  70. data/ext/noderb_extension/libuv/test/test-getsockname.c +142 -16
  71. data/ext/noderb_extension/libuv/test/test-idle.c +4 -3
  72. data/ext/noderb_extension/libuv/test/test-list.h +29 -2
  73. data/ext/noderb_extension/libuv/test/test-loop-handles.c +9 -8
  74. data/ext/noderb_extension/libuv/test/test-ping-pong.c +9 -9
  75. data/ext/noderb_extension/libuv/test/test-pipe-bind-error.c +18 -14
  76. data/ext/noderb_extension/libuv/test/test-ref.c +17 -16
  77. data/ext/noderb_extension/libuv/test/test-shutdown-eof.c +5 -5
  78. data/ext/noderb_extension/libuv/test/test-spawn.c +17 -17
  79. data/ext/noderb_extension/libuv/test/test-tcp-bind-error.c +24 -18
  80. data/ext/noderb_extension/libuv/test/test-tcp-bind6-error.c +19 -14
  81. data/ext/noderb_extension/libuv/test/test-tcp-writealot.c +6 -5
  82. data/ext/noderb_extension/libuv/test/test-threadpool.c +59 -0
  83. data/ext/noderb_extension/libuv/test/test-timer-again.c +15 -12
  84. data/ext/noderb_extension/libuv/test/test-timer.c +8 -8
  85. data/ext/noderb_extension/libuv/test/test-udp-dgram-too-big.c +88 -0
  86. data/ext/noderb_extension/libuv/test/test-udp-ipv6.c +158 -0
  87. data/ext/noderb_extension/libuv/test/test-udp-send-and-recv.c +210 -0
  88. data/ext/noderb_extension/libuv/{all.gyp → uv.gyp} +75 -77
  89. data/ext/noderb_extension/libuv/vcbuild.bat +93 -0
  90. data/ext/noderb_extension/noderb.c +13 -0
  91. data/ext/noderb_extension/noderb_common.h +2 -1
  92. data/ext/noderb_extension/noderb_defer.c +54 -0
  93. data/ext/noderb_extension/noderb_defer.h +15 -0
  94. data/ext/noderb_extension/noderb_dns.c +1 -1
  95. data/ext/noderb_extension/noderb_fs.c +277 -0
  96. data/ext/noderb_extension/noderb_fs.h +27 -0
  97. data/ext/noderb_extension/noderb_process.c +5 -5
  98. data/ext/noderb_extension/noderb_tcp.c +10 -6
  99. data/ext/noderb_extension/noderb_timers.c +1 -1
  100. data/ext/noderb_extension/noderb_tools.c +42 -8
  101. data/ext/noderb_extension/noderb_tools.h +3 -1
  102. data/lib/noderb/defer.rb +25 -0
  103. data/lib/noderb/file.rb +119 -0
  104. data/lib/noderb/fs.rb +72 -0
  105. data/lib/noderb/version.rb +1 -1
  106. data/lib/noderb.rb +8 -0
  107. metadata +102 -266
  108. data/ext/noderb_extension/libuv/BSDmakefile +0 -2
  109. data/ext/noderb_extension/libuv/create-msvs-files.bat +0 -21
  110. data/ext/noderb_extension/libuv/deps/pthread-win32/ANNOUNCE +0 -482
  111. data/ext/noderb_extension/libuv/deps/pthread-win32/BUGS +0 -141
  112. data/ext/noderb_extension/libuv/deps/pthread-win32/Bmakefile +0 -268
  113. data/ext/noderb_extension/libuv/deps/pthread-win32/CONTRIBUTORS +0 -140
  114. data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING +0 -150
  115. data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING.LIB +0 -504
  116. data/ext/noderb_extension/libuv/deps/pthread-win32/ChangeLog +0 -5194
  117. data/ext/noderb_extension/libuv/deps/pthread-win32/FAQ +0 -451
  118. data/ext/noderb_extension/libuv/deps/pthread-win32/GNUmakefile +0 -593
  119. data/ext/noderb_extension/libuv/deps/pthread-win32/MAINTAINERS +0 -4
  120. data/ext/noderb_extension/libuv/deps/pthread-win32/Makefile +0 -516
  121. data/ext/noderb_extension/libuv/deps/pthread-win32/NEWS +0 -1245
  122. data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile +0 -24
  123. data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile.tests +0 -260
  124. data/ext/noderb_extension/libuv/deps/pthread-win32/PROGRESS +0 -4
  125. data/ext/noderb_extension/libuv/deps/pthread-win32/README +0 -601
  126. data/ext/noderb_extension/libuv/deps/pthread-win32/README.Borland +0 -57
  127. data/ext/noderb_extension/libuv/deps/pthread-win32/README.CV +0 -3036
  128. data/ext/noderb_extension/libuv/deps/pthread-win32/README.NONPORTABLE +0 -783
  129. data/ext/noderb_extension/libuv/deps/pthread-win32/README.Watcom +0 -62
  130. data/ext/noderb_extension/libuv/deps/pthread-win32/README.WinCE +0 -6
  131. data/ext/noderb_extension/libuv/deps/pthread-win32/TODO +0 -7
  132. data/ext/noderb_extension/libuv/deps/pthread-win32/WinCE-PORT +0 -222
  133. data/ext/noderb_extension/libuv/deps/pthread-win32/attr.c +0 -53
  134. data/ext/noderb_extension/libuv/deps/pthread-win32/autostatic.c +0 -69
  135. data/ext/noderb_extension/libuv/deps/pthread-win32/barrier.c +0 -47
  136. data/ext/noderb_extension/libuv/deps/pthread-win32/build/all.gyp +0 -207
  137. data/ext/noderb_extension/libuv/deps/pthread-win32/builddmc.bat +0 -9
  138. data/ext/noderb_extension/libuv/deps/pthread-win32/cancel.c +0 -44
  139. data/ext/noderb_extension/libuv/deps/pthread-win32/cleanup.c +0 -148
  140. data/ext/noderb_extension/libuv/deps/pthread-win32/condvar.c +0 -50
  141. data/ext/noderb_extension/libuv/deps/pthread-win32/config.h +0 -153
  142. data/ext/noderb_extension/libuv/deps/pthread-win32/context.h +0 -74
  143. data/ext/noderb_extension/libuv/deps/pthread-win32/create.c +0 -308
  144. data/ext/noderb_extension/libuv/deps/pthread-win32/dll.c +0 -92
  145. data/ext/noderb_extension/libuv/deps/pthread-win32/errno.c +0 -94
  146. data/ext/noderb_extension/libuv/deps/pthread-win32/exit.c +0 -44
  147. data/ext/noderb_extension/libuv/deps/pthread-win32/fork.c +0 -39
  148. data/ext/noderb_extension/libuv/deps/pthread-win32/global.c +0 -107
  149. data/ext/noderb_extension/libuv/deps/pthread-win32/implement.h +0 -944
  150. data/ext/noderb_extension/libuv/deps/pthread-win32/misc.c +0 -50
  151. data/ext/noderb_extension/libuv/deps/pthread-win32/mutex.c +0 -62
  152. data/ext/noderb_extension/libuv/deps/pthread-win32/need_errno.h +0 -145
  153. data/ext/noderb_extension/libuv/deps/pthread-win32/nonportable.c +0 -47
  154. data/ext/noderb_extension/libuv/deps/pthread-win32/private.c +0 -54
  155. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.c +0 -66
  156. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsp +0 -142
  157. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsw +0 -29
  158. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.h +0 -1368
  159. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_destroy.c +0 -79
  160. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getdetachstate.c +0 -86
  161. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getinheritsched.c +0 -51
  162. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedparam.c +0 -52
  163. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedpolicy.c +0 -61
  164. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getscope.c +0 -54
  165. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstackaddr.c +0 -97
  166. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstacksize.c +0 -100
  167. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_init.c +0 -117
  168. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setdetachstate.c +0 -91
  169. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setinheritsched.c +0 -57
  170. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedparam.c +0 -63
  171. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedpolicy.c +0 -55
  172. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setscope.c +0 -62
  173. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstackaddr.c +0 -97
  174. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstacksize.c +0 -110
  175. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_destroy.c +0 -103
  176. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_init.c +0 -69
  177. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_wait.c +0 -104
  178. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_destroy.c +0 -83
  179. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_getpshared.c +0 -95
  180. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_init.c +0 -85
  181. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_setpshared.c +0 -119
  182. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cancel.c +0 -189
  183. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_destroy.c +0 -253
  184. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_init.c +0 -167
  185. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_signal.c +0 -231
  186. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_wait.c +0 -567
  187. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_destroy.c +0 -86
  188. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_getpshared.c +0 -97
  189. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_init.c +0 -87
  190. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_setpshared.c +0 -117
  191. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_delay_np.c +0 -172
  192. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_detach.c +0 -136
  193. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_equal.c +0 -76
  194. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_exit.c +0 -106
  195. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getconcurrency.c +0 -45
  196. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getschedparam.c +0 -75
  197. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getspecific.c +0 -87
  198. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getunique_np.c +0 -47
  199. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getw32threadhandle_np.c +0 -65
  200. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_join.c +0 -157
  201. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_create.c +0 -108
  202. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_delete.c +0 -125
  203. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_kill.c +0 -105
  204. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_consistent.c +0 -187
  205. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_destroy.c +0 -148
  206. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_init.c +0 -130
  207. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_lock.c +0 -269
  208. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_timedlock.c +0 -324
  209. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_trylock.c +0 -154
  210. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_unlock.c +0 -175
  211. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_destroy.c +0 -83
  212. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getkind_np.c +0 -44
  213. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getpshared.c +0 -95
  214. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getrobust.c +0 -113
  215. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_gettype.c +0 -56
  216. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_init.c +0 -86
  217. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setkind_np.c +0 -44
  218. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setpshared.c +0 -119
  219. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setrobust.c +0 -119
  220. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_settype.c +0 -143
  221. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_num_processors_np.c +0 -56
  222. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_once.c +0 -79
  223. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_destroy.c +0 -143
  224. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_init.c +0 -109
  225. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_rdlock.c +0 -102
  226. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedrdlock.c +0 -109
  227. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedwrlock.c +0 -139
  228. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_tryrdlock.c +0 -102
  229. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_trywrlock.c +0 -122
  230. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_unlock.c +0 -93
  231. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_wrlock.c +0 -133
  232. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_destroy.c +0 -84
  233. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_getpshared.c +0 -97
  234. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_init.c +0 -83
  235. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_setpshared.c +0 -120
  236. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_self.c +0 -141
  237. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcancelstate.c +0 -125
  238. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcanceltype.c +0 -126
  239. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setconcurrency.c +0 -53
  240. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setschedparam.c +0 -123
  241. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setspecific.c +0 -167
  242. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_destroy.c +0 -111
  243. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_init.c +0 -123
  244. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_lock.c +0 -80
  245. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_trylock.c +0 -77
  246. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_unlock.c +0 -71
  247. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_testcancel.c +0 -103
  248. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_timechange_handler_np.c +0 -108
  249. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_win32_attach_detach_np.c +0 -258
  250. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_MCS_lock.c +0 -278
  251. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_callUserDestroyRoutines.c +0 -232
  252. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_calloc.c +0 -56
  253. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_cond_check_need_init.c +0 -78
  254. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_getprocessors.c +0 -91
  255. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_is_attr.c +0 -47
  256. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_mutex_check_need_init.c +0 -92
  257. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_new.c +0 -94
  258. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processInitialize.c +0 -92
  259. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processTerminate.c +0 -105
  260. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_relmillisecs.c +0 -132
  261. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_reuse.c +0 -151
  262. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_cancelwrwait.c +0 -50
  263. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_check_need_init.c +0 -77
  264. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_semwait.c +0 -135
  265. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_spinlock_check_need_init.c +0 -78
  266. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadDestroy.c +0 -79
  267. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadStart.c +0 -357
  268. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_throw.c +0 -189
  269. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_timespec.c +0 -83
  270. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocCreate.c +0 -118
  271. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocDestroy.c +0 -114
  272. data/ext/noderb_extension/libuv/deps/pthread-win32/rwlock.c +0 -51
  273. data/ext/noderb_extension/libuv/deps/pthread-win32/sched.c +0 -53
  274. data/ext/noderb_extension/libuv/deps/pthread-win32/sched.h +0 -183
  275. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_max.c +0 -134
  276. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_min.c +0 -135
  277. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_getscheduler.c +0 -71
  278. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_setscheduler.c +0 -83
  279. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_yield.c +0 -71
  280. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_close.c +0 -58
  281. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_destroy.c +0 -144
  282. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_getvalue.c +0 -110
  283. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_init.c +0 -169
  284. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_open.c +0 -58
  285. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post.c +0 -128
  286. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post_multiple.c +0 -142
  287. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_timedwait.c +0 -238
  288. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_trywait.c +0 -117
  289. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_unlink.c +0 -58
  290. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_wait.c +0 -187
  291. data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.c +0 -69
  292. data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.h +0 -169
  293. data/ext/noderb_extension/libuv/deps/pthread-win32/signal.c +0 -179
  294. data/ext/noderb_extension/libuv/deps/pthread-win32/spin.c +0 -46
  295. data/ext/noderb_extension/libuv/deps/pthread-win32/sync.c +0 -43
  296. data/ext/noderb_extension/libuv/deps/pthread-win32/tsd.c +0 -44
  297. data/ext/noderb_extension/libuv/deps/pthread-win32/version.rc +0 -388
  298. data/ext/noderb_extension/libuv/deps/pthread-win32/w32_CancelableWait.c +0 -161
  299. data/ext/noderb_extension/libuv/doc/iocp-links.html +0 -574
  300. data/ext/noderb_extension/libuv/src/uv-unix.c +0 -2421
  301. data/ext/noderb_extension/libuv/src/win/ntdll.h +0 -130
  302. /data/ext/noderb_extension/libuv/include/{ev.h → uv-private/ev.h} +0 -0
  303. /data/ext/noderb_extension/libuv/include/{ngx-queue.h → uv-private/ngx-queue.h} +0 -0
  304. /data/ext/noderb_extension/libuv/include/{tree.h → uv-private/tree.h} +0 -0
  305. /data/ext/noderb_extension/libuv/src/{uv-cygwin.c → unix/cygwin.c} +0 -0
  306. /data/ext/noderb_extension/libuv/src/{uv-darwin.c → unix/darwin.c} +0 -0
  307. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/Changes +0 -0
  308. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/LICENSE +0 -0
  309. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/Makefile.am +0 -0
  310. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/aclocal.m4 +0 -0
  311. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/autogen.sh +0 -0
  312. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config.h.in +0 -0
  313. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_cygwin.h +0 -0
  314. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_freebsd.h +0 -0
  315. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_sunos.h +0 -0
  316. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/configure.ac +0 -0
  317. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/demo.c +0 -0
  318. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/ecb.h +0 -0
  319. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/eio.3 +0 -0
  320. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/eio.pod +0 -0
  321. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/libeio.m4 +0 -0
  322. /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/xthread.h +0 -0
  323. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/Changes +0 -0
  324. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/LICENSE +0 -0
  325. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/Makefile.am +0 -0
  326. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/Makefile.in +0 -0
  327. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/README +0 -0
  328. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/aclocal.m4 +0 -0
  329. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/autogen.sh +0 -0
  330. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config.guess +0 -0
  331. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config.h.in +0 -0
  332. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config.sub +0 -0
  333. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_cygwin.h +0 -0
  334. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_darwin.h +0 -0
  335. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_freebsd.h +0 -0
  336. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_sunos.h +0 -0
  337. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/configure +0 -0
  338. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/configure.ac +0 -0
  339. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/depcomp +0 -0
  340. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev++.h +0 -0
  341. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev.3 +0 -0
  342. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev.c +0 -0
  343. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev.pod +0 -0
  344. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_epoll.c +0 -0
  345. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_kqueue.c +0 -0
  346. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_poll.c +0 -0
  347. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_port.c +0 -0
  348. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_select.c +0 -0
  349. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_vars.h +0 -0
  350. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_win32.c +0 -0
  351. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_wrap.h +0 -0
  352. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/event.c +0 -0
  353. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/event.h +0 -0
  354. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/install-sh +0 -0
  355. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/libev.m4 +0 -0
  356. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ltmain.sh +0 -0
  357. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/missing +0 -0
  358. /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/mkinstalldirs +0 -0
  359. /data/ext/noderb_extension/libuv/src/{uv-freebsd.c → unix/freebsd.c} +0 -0
  360. /data/ext/noderb_extension/libuv/src/{uv-linux.c → unix/linux.c} +0 -0
  361. /data/ext/noderb_extension/libuv/src/{uv-sunos.c → unix/sunos.c} +0 -0
@@ -1,567 +0,0 @@
1
- /*
2
- * pthread_cond_wait.c
3
- *
4
- * Description:
5
- * This translation unit implements condition variables and their primitives.
6
- *
7
- *
8
- * --------------------------------------------------------------------------
9
- *
10
- * Pthreads-win32 - POSIX Threads Library for Win32
11
- * Copyright(C) 1998 John E. Bossom
12
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
13
- *
14
- * Contact Email: rpj@callisto.canberra.edu.au
15
- *
16
- * The current list of contributors is contained
17
- * in the file CONTRIBUTORS included with the source
18
- * code distribution. The list can also be seen at the
19
- * following World Wide Web location:
20
- * http://sources.redhat.com/pthreads-win32/contributors.html
21
- *
22
- * This library is free software; you can redistribute it and/or
23
- * modify it under the terms of the GNU Lesser General Public
24
- * License as published by the Free Software Foundation; either
25
- * version 2 of the License, or (at your option) any later version.
26
- *
27
- * This library is distributed in the hope that it will be useful,
28
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30
- * Lesser General Public License for more details.
31
- *
32
- * You should have received a copy of the GNU Lesser General Public
33
- * License along with this library in the file COPYING.LIB;
34
- * if not, write to the Free Software Foundation, Inc.,
35
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
36
- *
37
- * -------------------------------------------------------------
38
- * Algorithm:
39
- * The algorithm used in this implementation is that developed by
40
- * Alexander Terekhov in colaboration with Louis Thomas. The bulk
41
- * of the discussion is recorded in the file README.CV, which contains
42
- * several generations of both colaborators original algorithms. The final
43
- * algorithm used here is the one referred to as
44
- *
45
- * Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL
46
- *
47
- * presented below in pseudo-code as it appeared:
48
- *
49
- *
50
- * given:
51
- * semBlockLock - bin.semaphore
52
- * semBlockQueue - semaphore
53
- * mtxExternal - mutex or CS
54
- * mtxUnblockLock - mutex or CS
55
- * nWaitersGone - int
56
- * nWaitersBlocked - int
57
- * nWaitersToUnblock - int
58
- *
59
- * wait( timeout ) {
60
- *
61
- * [auto: register int result ] // error checking omitted
62
- * [auto: register int nSignalsWasLeft ]
63
- * [auto: register int nWaitersWasGone ]
64
- *
65
- * sem_wait( semBlockLock );
66
- * nWaitersBlocked++;
67
- * sem_post( semBlockLock );
68
- *
69
- * unlock( mtxExternal );
70
- * bTimedOut = sem_wait( semBlockQueue,timeout );
71
- *
72
- * lock( mtxUnblockLock );
73
- * if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) {
74
- * if ( bTimeout ) { // timeout (or canceled)
75
- * if ( 0 != nWaitersBlocked ) {
76
- * nWaitersBlocked--;
77
- * }
78
- * else {
79
- * nWaitersGone++; // count spurious wakeups.
80
- * }
81
- * }
82
- * if ( 0 == --nWaitersToUnblock ) {
83
- * if ( 0 != nWaitersBlocked ) {
84
- * sem_post( semBlockLock ); // open the gate.
85
- * nSignalsWasLeft = 0; // do not open the gate
86
- * // below again.
87
- * }
88
- * else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {
89
- * nWaitersGone = 0;
90
- * }
91
- * }
92
- * }
93
- * else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or
94
- * // spurious semaphore :-)
95
- * sem_wait( semBlockLock );
96
- * nWaitersBlocked -= nWaitersGone; // something is going on here
97
- * // - test of timeouts? :-)
98
- * sem_post( semBlockLock );
99
- * nWaitersGone = 0;
100
- * }
101
- * unlock( mtxUnblockLock );
102
- *
103
- * if ( 1 == nSignalsWasLeft ) {
104
- * if ( 0 != nWaitersWasGone ) {
105
- * // sem_adjust( semBlockQueue,-nWaitersWasGone );
106
- * while ( nWaitersWasGone-- ) {
107
- * sem_wait( semBlockQueue ); // better now than spurious later
108
- * }
109
- * } sem_post( semBlockLock ); // open the gate
110
- * }
111
- *
112
- * lock( mtxExternal );
113
- *
114
- * return ( bTimedOut ) ? ETIMEOUT : 0;
115
- * }
116
- *
117
- * signal(bAll) {
118
- *
119
- * [auto: register int result ]
120
- * [auto: register int nSignalsToIssue]
121
- *
122
- * lock( mtxUnblockLock );
123
- *
124
- * if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
125
- * if ( 0 == nWaitersBlocked ) { // NO-OP
126
- * return unlock( mtxUnblockLock );
127
- * }
128
- * if (bAll) {
129
- * nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked;
130
- * nWaitersBlocked = 0;
131
- * }
132
- * else {
133
- * nSignalsToIssue = 1;
134
- * nWaitersToUnblock++;
135
- * nWaitersBlocked--;
136
- * }
137
- * }
138
- * else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
139
- * sem_wait( semBlockLock ); // close the gate
140
- * if ( 0 != nWaitersGone ) {
141
- * nWaitersBlocked -= nWaitersGone;
142
- * nWaitersGone = 0;
143
- * }
144
- * if (bAll) {
145
- * nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked;
146
- * nWaitersBlocked = 0;
147
- * }
148
- * else {
149
- * nSignalsToIssue = nWaitersToUnblock = 1;
150
- * nWaitersBlocked--;
151
- * }
152
- * }
153
- * else { // NO-OP
154
- * return unlock( mtxUnblockLock );
155
- * }
156
- *
157
- * unlock( mtxUnblockLock );
158
- * sem_post( semBlockQueue,nSignalsToIssue );
159
- * return result;
160
- * }
161
- * -------------------------------------------------------------
162
- *
163
- * Algorithm 9 / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL
164
- *
165
- * presented below in pseudo-code; basically 8a...
166
- * ...BUT W/O "spurious wakes" prevention:
167
- *
168
- *
169
- * given:
170
- * semBlockLock - bin.semaphore
171
- * semBlockQueue - semaphore
172
- * mtxExternal - mutex or CS
173
- * mtxUnblockLock - mutex or CS
174
- * nWaitersGone - int
175
- * nWaitersBlocked - int
176
- * nWaitersToUnblock - int
177
- *
178
- * wait( timeout ) {
179
- *
180
- * [auto: register int result ] // error checking omitted
181
- * [auto: register int nSignalsWasLeft ]
182
- *
183
- * sem_wait( semBlockLock );
184
- * ++nWaitersBlocked;
185
- * sem_post( semBlockLock );
186
- *
187
- * unlock( mtxExternal );
188
- * bTimedOut = sem_wait( semBlockQueue,timeout );
189
- *
190
- * lock( mtxUnblockLock );
191
- * if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) {
192
- * --nWaitersToUnblock;
193
- * }
194
- * else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or
195
- * // spurious semaphore :-)
196
- * sem_wait( semBlockLock );
197
- * nWaitersBlocked -= nWaitersGone; // something is going on here
198
- * // - test of timeouts? :-)
199
- * sem_post( semBlockLock );
200
- * nWaitersGone = 0;
201
- * }
202
- * unlock( mtxUnblockLock );
203
- *
204
- * if ( 1 == nSignalsWasLeft ) {
205
- * sem_post( semBlockLock ); // open the gate
206
- * }
207
- *
208
- * lock( mtxExternal );
209
- *
210
- * return ( bTimedOut ) ? ETIMEOUT : 0;
211
- * }
212
- *
213
- * signal(bAll) {
214
- *
215
- * [auto: register int result ]
216
- * [auto: register int nSignalsToIssue]
217
- *
218
- * lock( mtxUnblockLock );
219
- *
220
- * if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
221
- * if ( 0 == nWaitersBlocked ) { // NO-OP
222
- * return unlock( mtxUnblockLock );
223
- * }
224
- * if (bAll) {
225
- * nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked;
226
- * nWaitersBlocked = 0;
227
- * }
228
- * else {
229
- * nSignalsToIssue = 1;
230
- * ++nWaitersToUnblock;
231
- * --nWaitersBlocked;
232
- * }
233
- * }
234
- * else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
235
- * sem_wait( semBlockLock ); // close the gate
236
- * if ( 0 != nWaitersGone ) {
237
- * nWaitersBlocked -= nWaitersGone;
238
- * nWaitersGone = 0;
239
- * }
240
- * if (bAll) {
241
- * nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked;
242
- * nWaitersBlocked = 0;
243
- * }
244
- * else {
245
- * nSignalsToIssue = nWaitersToUnblock = 1;
246
- * --nWaitersBlocked;
247
- * }
248
- * }
249
- * else { // NO-OP
250
- * return unlock( mtxUnblockLock );
251
- * }
252
- *
253
- * unlock( mtxUnblockLock );
254
- * sem_post( semBlockQueue,nSignalsToIssue );
255
- * return result;
256
- * }
257
- * -------------------------------------------------------------
258
- *
259
- */
260
-
261
- #include "pthread.h"
262
- #include "implement.h"
263
-
264
- /*
265
- * Arguments for cond_wait_cleanup, since we can only pass a
266
- * single void * to it.
267
- */
268
- typedef struct
269
- {
270
- pthread_mutex_t *mutexPtr;
271
- pthread_cond_t cv;
272
- int *resultPtr;
273
- } ptw32_cond_wait_cleanup_args_t;
274
-
275
- static void PTW32_CDECL
276
- ptw32_cond_wait_cleanup (void *args)
277
- {
278
- ptw32_cond_wait_cleanup_args_t *cleanup_args =
279
- (ptw32_cond_wait_cleanup_args_t *) args;
280
- pthread_cond_t cv = cleanup_args->cv;
281
- int *resultPtr = cleanup_args->resultPtr;
282
- int nSignalsWasLeft;
283
- int result;
284
-
285
- /*
286
- * Whether we got here as a result of signal/broadcast or because of
287
- * timeout on wait or thread cancellation we indicate that we are no
288
- * longer waiting. The waiter is responsible for adjusting waiters
289
- * (to)unblock(ed) counts (protected by unblock lock).
290
- */
291
- if ((result = pthread_mutex_lock (&(cv->mtxUnblockLock))) != 0)
292
- {
293
- *resultPtr = result;
294
- return;
295
- }
296
-
297
- if (0 != (nSignalsWasLeft = cv->nWaitersToUnblock))
298
- {
299
- --(cv->nWaitersToUnblock);
300
- }
301
- else if (INT_MAX / 2 == ++(cv->nWaitersGone))
302
- {
303
- /* Use the non-cancellable version of sem_wait() */
304
- if (ptw32_semwait (&(cv->semBlockLock)) != 0)
305
- {
306
- *resultPtr = errno;
307
- /*
308
- * This is a fatal error for this CV,
309
- * so we deliberately don't unlock
310
- * cv->mtxUnblockLock before returning.
311
- */
312
- return;
313
- }
314
- cv->nWaitersBlocked -= cv->nWaitersGone;
315
- if (sem_post (&(cv->semBlockLock)) != 0)
316
- {
317
- *resultPtr = errno;
318
- /*
319
- * This is a fatal error for this CV,
320
- * so we deliberately don't unlock
321
- * cv->mtxUnblockLock before returning.
322
- */
323
- return;
324
- }
325
- cv->nWaitersGone = 0;
326
- }
327
-
328
- if ((result = pthread_mutex_unlock (&(cv->mtxUnblockLock))) != 0)
329
- {
330
- *resultPtr = result;
331
- return;
332
- }
333
-
334
- if (1 == nSignalsWasLeft)
335
- {
336
- if (sem_post (&(cv->semBlockLock)) != 0)
337
- {
338
- *resultPtr = errno;
339
- return;
340
- }
341
- }
342
-
343
- /*
344
- * XSH: Upon successful return, the mutex has been locked and is owned
345
- * by the calling thread.
346
- */
347
- if ((result = pthread_mutex_lock (cleanup_args->mutexPtr)) != 0)
348
- {
349
- *resultPtr = result;
350
- }
351
- } /* ptw32_cond_wait_cleanup */
352
-
353
- static INLINE int
354
- ptw32_cond_timedwait (pthread_cond_t * cond,
355
- pthread_mutex_t * mutex, const struct timespec *abstime)
356
- {
357
- int result = 0;
358
- pthread_cond_t cv;
359
- ptw32_cond_wait_cleanup_args_t cleanup_args;
360
-
361
- if (cond == NULL || *cond == NULL)
362
- {
363
- return EINVAL;
364
- }
365
-
366
- /*
367
- * We do a quick check to see if we need to do more work
368
- * to initialise a static condition variable. We check
369
- * again inside the guarded section of ptw32_cond_check_need_init()
370
- * to avoid race conditions.
371
- */
372
- if (*cond == PTHREAD_COND_INITIALIZER)
373
- {
374
- result = ptw32_cond_check_need_init (cond);
375
- }
376
-
377
- if (result != 0 && result != EBUSY)
378
- {
379
- return result;
380
- }
381
-
382
- cv = *cond;
383
-
384
- /* Thread can be cancelled in sem_wait() but this is OK */
385
- if (sem_wait (&(cv->semBlockLock)) != 0)
386
- {
387
- return errno;
388
- }
389
-
390
- ++(cv->nWaitersBlocked);
391
-
392
- if (sem_post (&(cv->semBlockLock)) != 0)
393
- {
394
- return errno;
395
- }
396
-
397
- /*
398
- * Setup this waiter cleanup handler
399
- */
400
- cleanup_args.mutexPtr = mutex;
401
- cleanup_args.cv = cv;
402
- cleanup_args.resultPtr = &result;
403
-
404
- #if defined(_MSC_VER) && _MSC_VER < 1400
405
- #pragma inline_depth(0)
406
- #endif
407
- pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *) &cleanup_args);
408
-
409
- /*
410
- * Now we can release 'mutex' and...
411
- */
412
- if ((result = pthread_mutex_unlock (mutex)) == 0)
413
- {
414
-
415
- /*
416
- * ...wait to be awakened by
417
- * pthread_cond_signal, or
418
- * pthread_cond_broadcast, or
419
- * timeout, or
420
- * thread cancellation
421
- *
422
- * Note:
423
- *
424
- * sem_timedwait is a cancellation point,
425
- * hence providing the mechanism for making
426
- * pthread_cond_wait a cancellation point.
427
- * We use the cleanup mechanism to ensure we
428
- * re-lock the mutex and adjust (to)unblock(ed) waiters
429
- * counts if we are cancelled, timed out or signalled.
430
- */
431
- if (sem_timedwait (&(cv->semBlockQueue), abstime) != 0)
432
- {
433
- result = errno;
434
- }
435
- }
436
-
437
- /*
438
- * Always cleanup
439
- */
440
- pthread_cleanup_pop (1);
441
- #if defined(_MSC_VER) && _MSC_VER < 1400
442
- #pragma inline_depth()
443
- #endif
444
-
445
- /*
446
- * "result" can be modified by the cleanup handler.
447
- */
448
- return result;
449
-
450
- } /* ptw32_cond_timedwait */
451
-
452
-
453
- int
454
- pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex)
455
- /*
456
- * ------------------------------------------------------
457
- * DOCPUBLIC
458
- * This function waits on a condition variable until
459
- * awakened by a signal or broadcast.
460
- *
461
- * Caller MUST be holding the mutex lock; the
462
- * lock is released and the caller is blocked waiting
463
- * on 'cond'. When 'cond' is signaled, the mutex
464
- * is re-acquired before returning to the caller.
465
- *
466
- * PARAMETERS
467
- * cond
468
- * pointer to an instance of pthread_cond_t
469
- *
470
- * mutex
471
- * pointer to an instance of pthread_mutex_t
472
- *
473
- *
474
- * DESCRIPTION
475
- * This function waits on a condition variable until
476
- * awakened by a signal or broadcast.
477
- *
478
- * NOTES:
479
- *
480
- * 1) The function must be called with 'mutex' LOCKED
481
- * by the calling thread, or undefined behaviour
482
- * will result.
483
- *
484
- * 2) This routine atomically releases 'mutex' and causes
485
- * the calling thread to block on the condition variable.
486
- * The blocked thread may be awakened by
487
- * pthread_cond_signal or
488
- * pthread_cond_broadcast.
489
- *
490
- * Upon successful completion, the 'mutex' has been locked and
491
- * is owned by the calling thread.
492
- *
493
- *
494
- * RESULTS
495
- * 0 caught condition; mutex released,
496
- * EINVAL 'cond' or 'mutex' is invalid,
497
- * EINVAL different mutexes for concurrent waits,
498
- * EINVAL mutex is not held by the calling thread,
499
- *
500
- * ------------------------------------------------------
501
- */
502
- {
503
- /*
504
- * The NULL abstime arg means INFINITE waiting.
505
- */
506
- return (ptw32_cond_timedwait (cond, mutex, NULL));
507
-
508
- } /* pthread_cond_wait */
509
-
510
-
511
- int
512
- pthread_cond_timedwait (pthread_cond_t * cond,
513
- pthread_mutex_t * mutex,
514
- const struct timespec *abstime)
515
- /*
516
- * ------------------------------------------------------
517
- * DOCPUBLIC
518
- * This function waits on a condition variable either until
519
- * awakened by a signal or broadcast; or until the time
520
- * specified by abstime passes.
521
- *
522
- * PARAMETERS
523
- * cond
524
- * pointer to an instance of pthread_cond_t
525
- *
526
- * mutex
527
- * pointer to an instance of pthread_mutex_t
528
- *
529
- * abstime
530
- * pointer to an instance of (const struct timespec)
531
- *
532
- *
533
- * DESCRIPTION
534
- * This function waits on a condition variable either until
535
- * awakened by a signal or broadcast; or until the time
536
- * specified by abstime passes.
537
- *
538
- * NOTES:
539
- * 1) The function must be called with 'mutex' LOCKED
540
- * by the calling thread, or undefined behaviour
541
- * will result.
542
- *
543
- * 2) This routine atomically releases 'mutex' and causes
544
- * the calling thread to block on the condition variable.
545
- * The blocked thread may be awakened by
546
- * pthread_cond_signal or
547
- * pthread_cond_broadcast.
548
- *
549
- *
550
- * RESULTS
551
- * 0 caught condition; mutex released,
552
- * EINVAL 'cond', 'mutex', or abstime is invalid,
553
- * EINVAL different mutexes for concurrent waits,
554
- * EINVAL mutex is not held by the calling thread,
555
- * ETIMEDOUT abstime ellapsed before cond was signaled.
556
- *
557
- * ------------------------------------------------------
558
- */
559
- {
560
- if (abstime == NULL)
561
- {
562
- return EINVAL;
563
- }
564
-
565
- return (ptw32_cond_timedwait (cond, mutex, abstime));
566
-
567
- } /* pthread_cond_timedwait */
@@ -1,86 +0,0 @@
1
- /*
2
- * condvar_attr_destroy.c
3
- *
4
- * Description:
5
- * This translation unit implements condition variables and their primitives.
6
- *
7
- *
8
- * --------------------------------------------------------------------------
9
- *
10
- * Pthreads-win32 - POSIX Threads Library for Win32
11
- * Copyright(C) 1998 John E. Bossom
12
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
13
- *
14
- * Contact Email: rpj@callisto.canberra.edu.au
15
- *
16
- * The current list of contributors is contained
17
- * in the file CONTRIBUTORS included with the source
18
- * code distribution. The list can also be seen at the
19
- * following World Wide Web location:
20
- * http://sources.redhat.com/pthreads-win32/contributors.html
21
- *
22
- * This library is free software; you can redistribute it and/or
23
- * modify it under the terms of the GNU Lesser General Public
24
- * License as published by the Free Software Foundation; either
25
- * version 2 of the License, or (at your option) any later version.
26
- *
27
- * This library is distributed in the hope that it will be useful,
28
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30
- * Lesser General Public License for more details.
31
- *
32
- * You should have received a copy of the GNU Lesser General Public
33
- * License along with this library in the file COPYING.LIB;
34
- * if not, write to the Free Software Foundation, Inc.,
35
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
36
- */
37
-
38
- #include "pthread.h"
39
- #include "implement.h"
40
-
41
-
42
- int
43
- pthread_condattr_destroy (pthread_condattr_t * attr)
44
- /*
45
- * ------------------------------------------------------
46
- * DOCPUBLIC
47
- * Destroys a condition variable attributes object.
48
- * The object can no longer be used.
49
- *
50
- * PARAMETERS
51
- * attr
52
- * pointer to an instance of pthread_condattr_t
53
- *
54
- *
55
- * DESCRIPTION
56
- * Destroys a condition variable attributes object.
57
- * The object can no longer be used.
58
- *
59
- * NOTES:
60
- * 1) Does not affect condition variables created
61
- * using 'attr'
62
- *
63
- * RESULTS
64
- * 0 successfully released attr,
65
- * EINVAL 'attr' is invalid.
66
- *
67
- * ------------------------------------------------------
68
- */
69
- {
70
- int result = 0;
71
-
72
- if (attr == NULL || *attr == NULL)
73
- {
74
- result = EINVAL;
75
- }
76
- else
77
- {
78
- (void) free (*attr);
79
-
80
- *attr = NULL;
81
- result = 0;
82
- }
83
-
84
- return result;
85
-
86
- } /* pthread_condattr_destroy */