noderb 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (424) hide show
  1. data/LICENSE +19 -0
  2. data/README.md +25 -0
  3. data/ext/noderb_extension/extconf.rb +11 -0
  4. data/ext/noderb_extension/libuv/AUTHORS +11 -0
  5. data/ext/noderb_extension/libuv/LICENSE +48 -0
  6. data/ext/noderb_extension/libuv/Makefile +119 -0
  7. data/ext/noderb_extension/libuv/README +45 -0
  8. data/ext/noderb_extension/libuv/build/all.gyp +254 -0
  9. data/ext/noderb_extension/libuv/build/common.gypi +13 -0
  10. data/ext/noderb_extension/libuv/build/gyp_uv +43 -0
  11. data/ext/noderb_extension/libuv/config-mingw.mk +67 -0
  12. data/ext/noderb_extension/libuv/config-unix.mk +121 -0
  13. data/ext/noderb_extension/libuv/create-msvs-files.bat +14 -0
  14. data/ext/noderb_extension/libuv/deps/pthread-win32/ANNOUNCE +482 -0
  15. data/ext/noderb_extension/libuv/deps/pthread-win32/BUGS +141 -0
  16. data/ext/noderb_extension/libuv/deps/pthread-win32/Bmakefile +268 -0
  17. data/ext/noderb_extension/libuv/deps/pthread-win32/CONTRIBUTORS +140 -0
  18. data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING +150 -0
  19. data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING.LIB +504 -0
  20. data/ext/noderb_extension/libuv/deps/pthread-win32/ChangeLog +5194 -0
  21. data/ext/noderb_extension/libuv/deps/pthread-win32/FAQ +451 -0
  22. data/ext/noderb_extension/libuv/deps/pthread-win32/GNUmakefile +593 -0
  23. data/ext/noderb_extension/libuv/deps/pthread-win32/MAINTAINERS +4 -0
  24. data/ext/noderb_extension/libuv/deps/pthread-win32/Makefile +516 -0
  25. data/ext/noderb_extension/libuv/deps/pthread-win32/NEWS +1245 -0
  26. data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile +24 -0
  27. data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile.tests +260 -0
  28. data/ext/noderb_extension/libuv/deps/pthread-win32/PROGRESS +4 -0
  29. data/ext/noderb_extension/libuv/deps/pthread-win32/README +601 -0
  30. data/ext/noderb_extension/libuv/deps/pthread-win32/README.Borland +57 -0
  31. data/ext/noderb_extension/libuv/deps/pthread-win32/README.CV +3036 -0
  32. data/ext/noderb_extension/libuv/deps/pthread-win32/README.NONPORTABLE +783 -0
  33. data/ext/noderb_extension/libuv/deps/pthread-win32/README.Watcom +62 -0
  34. data/ext/noderb_extension/libuv/deps/pthread-win32/README.WinCE +6 -0
  35. data/ext/noderb_extension/libuv/deps/pthread-win32/TODO +7 -0
  36. data/ext/noderb_extension/libuv/deps/pthread-win32/WinCE-PORT +222 -0
  37. data/ext/noderb_extension/libuv/deps/pthread-win32/attr.c +53 -0
  38. data/ext/noderb_extension/libuv/deps/pthread-win32/autostatic.c +69 -0
  39. data/ext/noderb_extension/libuv/deps/pthread-win32/barrier.c +47 -0
  40. data/ext/noderb_extension/libuv/deps/pthread-win32/build/all.gyp +207 -0
  41. data/ext/noderb_extension/libuv/deps/pthread-win32/builddmc.bat +9 -0
  42. data/ext/noderb_extension/libuv/deps/pthread-win32/cancel.c +44 -0
  43. data/ext/noderb_extension/libuv/deps/pthread-win32/cleanup.c +148 -0
  44. data/ext/noderb_extension/libuv/deps/pthread-win32/condvar.c +50 -0
  45. data/ext/noderb_extension/libuv/deps/pthread-win32/config.h +153 -0
  46. data/ext/noderb_extension/libuv/deps/pthread-win32/context.h +74 -0
  47. data/ext/noderb_extension/libuv/deps/pthread-win32/create.c +308 -0
  48. data/ext/noderb_extension/libuv/deps/pthread-win32/dll.c +92 -0
  49. data/ext/noderb_extension/libuv/deps/pthread-win32/errno.c +94 -0
  50. data/ext/noderb_extension/libuv/deps/pthread-win32/exit.c +44 -0
  51. data/ext/noderb_extension/libuv/deps/pthread-win32/fork.c +39 -0
  52. data/ext/noderb_extension/libuv/deps/pthread-win32/global.c +107 -0
  53. data/ext/noderb_extension/libuv/deps/pthread-win32/implement.h +944 -0
  54. data/ext/noderb_extension/libuv/deps/pthread-win32/misc.c +50 -0
  55. data/ext/noderb_extension/libuv/deps/pthread-win32/mutex.c +62 -0
  56. data/ext/noderb_extension/libuv/deps/pthread-win32/need_errno.h +145 -0
  57. data/ext/noderb_extension/libuv/deps/pthread-win32/nonportable.c +47 -0
  58. data/ext/noderb_extension/libuv/deps/pthread-win32/private.c +54 -0
  59. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.c +66 -0
  60. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsp +142 -0
  61. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsw +29 -0
  62. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.h +1368 -0
  63. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_destroy.c +79 -0
  64. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getdetachstate.c +86 -0
  65. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getinheritsched.c +51 -0
  66. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedparam.c +52 -0
  67. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedpolicy.c +61 -0
  68. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getscope.c +54 -0
  69. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstackaddr.c +97 -0
  70. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstacksize.c +100 -0
  71. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_init.c +117 -0
  72. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setdetachstate.c +91 -0
  73. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setinheritsched.c +57 -0
  74. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedparam.c +63 -0
  75. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedpolicy.c +55 -0
  76. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setscope.c +62 -0
  77. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstackaddr.c +97 -0
  78. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstacksize.c +110 -0
  79. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_destroy.c +103 -0
  80. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_init.c +69 -0
  81. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_wait.c +104 -0
  82. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_destroy.c +83 -0
  83. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_getpshared.c +95 -0
  84. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_init.c +85 -0
  85. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_setpshared.c +119 -0
  86. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cancel.c +189 -0
  87. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_destroy.c +253 -0
  88. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_init.c +167 -0
  89. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_signal.c +231 -0
  90. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_wait.c +567 -0
  91. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_destroy.c +86 -0
  92. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_getpshared.c +97 -0
  93. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_init.c +87 -0
  94. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_setpshared.c +117 -0
  95. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_delay_np.c +172 -0
  96. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_detach.c +136 -0
  97. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_equal.c +76 -0
  98. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_exit.c +106 -0
  99. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getconcurrency.c +45 -0
  100. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getschedparam.c +75 -0
  101. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getspecific.c +87 -0
  102. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getunique_np.c +47 -0
  103. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getw32threadhandle_np.c +65 -0
  104. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_join.c +157 -0
  105. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_create.c +108 -0
  106. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_delete.c +125 -0
  107. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_kill.c +105 -0
  108. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_consistent.c +187 -0
  109. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_destroy.c +148 -0
  110. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_init.c +130 -0
  111. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_lock.c +269 -0
  112. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_timedlock.c +324 -0
  113. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_trylock.c +154 -0
  114. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_unlock.c +175 -0
  115. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_destroy.c +83 -0
  116. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getkind_np.c +44 -0
  117. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getpshared.c +95 -0
  118. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getrobust.c +113 -0
  119. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_gettype.c +56 -0
  120. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_init.c +86 -0
  121. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setkind_np.c +44 -0
  122. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setpshared.c +119 -0
  123. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setrobust.c +119 -0
  124. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_settype.c +143 -0
  125. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_num_processors_np.c +56 -0
  126. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_once.c +79 -0
  127. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_destroy.c +143 -0
  128. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_init.c +109 -0
  129. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_rdlock.c +102 -0
  130. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedrdlock.c +109 -0
  131. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedwrlock.c +139 -0
  132. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_tryrdlock.c +102 -0
  133. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_trywrlock.c +122 -0
  134. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_unlock.c +93 -0
  135. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_wrlock.c +133 -0
  136. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_destroy.c +84 -0
  137. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_getpshared.c +97 -0
  138. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_init.c +83 -0
  139. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_setpshared.c +120 -0
  140. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_self.c +141 -0
  141. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcancelstate.c +125 -0
  142. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcanceltype.c +126 -0
  143. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setconcurrency.c +53 -0
  144. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setschedparam.c +123 -0
  145. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setspecific.c +167 -0
  146. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_destroy.c +111 -0
  147. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_init.c +123 -0
  148. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_lock.c +80 -0
  149. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_trylock.c +77 -0
  150. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_unlock.c +71 -0
  151. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_testcancel.c +103 -0
  152. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_timechange_handler_np.c +108 -0
  153. data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_win32_attach_detach_np.c +258 -0
  154. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_MCS_lock.c +278 -0
  155. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_callUserDestroyRoutines.c +232 -0
  156. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_calloc.c +56 -0
  157. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_cond_check_need_init.c +78 -0
  158. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_getprocessors.c +91 -0
  159. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_is_attr.c +47 -0
  160. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_mutex_check_need_init.c +92 -0
  161. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_new.c +94 -0
  162. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processInitialize.c +92 -0
  163. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processTerminate.c +105 -0
  164. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_relmillisecs.c +132 -0
  165. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_reuse.c +151 -0
  166. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_cancelwrwait.c +50 -0
  167. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_check_need_init.c +77 -0
  168. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_semwait.c +135 -0
  169. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_spinlock_check_need_init.c +78 -0
  170. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadDestroy.c +79 -0
  171. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadStart.c +357 -0
  172. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_throw.c +189 -0
  173. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_timespec.c +83 -0
  174. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocCreate.c +118 -0
  175. data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocDestroy.c +114 -0
  176. data/ext/noderb_extension/libuv/deps/pthread-win32/rwlock.c +51 -0
  177. data/ext/noderb_extension/libuv/deps/pthread-win32/sched.c +53 -0
  178. data/ext/noderb_extension/libuv/deps/pthread-win32/sched.h +183 -0
  179. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_max.c +134 -0
  180. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_min.c +135 -0
  181. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_getscheduler.c +71 -0
  182. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_setscheduler.c +83 -0
  183. data/ext/noderb_extension/libuv/deps/pthread-win32/sched_yield.c +71 -0
  184. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_close.c +58 -0
  185. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_destroy.c +144 -0
  186. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_getvalue.c +110 -0
  187. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_init.c +169 -0
  188. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_open.c +58 -0
  189. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post.c +128 -0
  190. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post_multiple.c +142 -0
  191. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_timedwait.c +238 -0
  192. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_trywait.c +117 -0
  193. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_unlink.c +58 -0
  194. data/ext/noderb_extension/libuv/deps/pthread-win32/sem_wait.c +187 -0
  195. data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.c +69 -0
  196. data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.h +169 -0
  197. data/ext/noderb_extension/libuv/deps/pthread-win32/signal.c +179 -0
  198. data/ext/noderb_extension/libuv/deps/pthread-win32/spin.c +46 -0
  199. data/ext/noderb_extension/libuv/deps/pthread-win32/sync.c +43 -0
  200. data/ext/noderb_extension/libuv/deps/pthread-win32/tsd.c +44 -0
  201. data/ext/noderb_extension/libuv/deps/pthread-win32/version.rc +388 -0
  202. data/ext/noderb_extension/libuv/deps/pthread-win32/w32_CancelableWait.c +161 -0
  203. data/ext/noderb_extension/libuv/doc/desired-api.md +159 -0
  204. data/ext/noderb_extension/libuv/doc/iocp-links.html +574 -0
  205. data/ext/noderb_extension/libuv/include/ares.h +582 -0
  206. data/ext/noderb_extension/libuv/include/ares_version.h +24 -0
  207. data/ext/noderb_extension/libuv/include/eio.h +376 -0
  208. data/ext/noderb_extension/libuv/include/ev.h +835 -0
  209. data/ext/noderb_extension/libuv/include/ngx-queue.h +102 -0
  210. data/ext/noderb_extension/libuv/include/tree.h +762 -0
  211. data/ext/noderb_extension/libuv/include/uv-unix.h +138 -0
  212. data/ext/noderb_extension/libuv/include/uv-win.h +187 -0
  213. data/ext/noderb_extension/libuv/include/uv.h +635 -0
  214. data/ext/noderb_extension/libuv/src/ares/AUTHORS +37 -0
  215. data/ext/noderb_extension/libuv/src/ares/CHANGES +1198 -0
  216. data/ext/noderb_extension/libuv/src/ares/CMakeLists.txt +22 -0
  217. data/ext/noderb_extension/libuv/src/ares/NEWS +21 -0
  218. data/ext/noderb_extension/libuv/src/ares/README +60 -0
  219. data/ext/noderb_extension/libuv/src/ares/README.cares +13 -0
  220. data/ext/noderb_extension/libuv/src/ares/README.msvc +118 -0
  221. data/ext/noderb_extension/libuv/src/ares/README.node +21 -0
  222. data/ext/noderb_extension/libuv/src/ares/RELEASE-NOTES +25 -0
  223. data/ext/noderb_extension/libuv/src/ares/TODO +23 -0
  224. data/ext/noderb_extension/libuv/src/ares/ares__close_sockets.c +66 -0
  225. data/ext/noderb_extension/libuv/src/ares/ares__get_hostent.c +263 -0
  226. data/ext/noderb_extension/libuv/src/ares/ares__read_line.c +71 -0
  227. data/ext/noderb_extension/libuv/src/ares/ares__timeval.c +111 -0
  228. data/ext/noderb_extension/libuv/src/ares/ares_cancel.c +63 -0
  229. data/ext/noderb_extension/libuv/src/ares/ares_data.c +190 -0
  230. data/ext/noderb_extension/libuv/src/ares/ares_data.h +65 -0
  231. data/ext/noderb_extension/libuv/src/ares/ares_destroy.c +105 -0
  232. data/ext/noderb_extension/libuv/src/ares/ares_dns.h +90 -0
  233. data/ext/noderb_extension/libuv/src/ares/ares_expand_name.c +193 -0
  234. data/ext/noderb_extension/libuv/src/ares/ares_expand_string.c +75 -0
  235. data/ext/noderb_extension/libuv/src/ares/ares_fds.c +62 -0
  236. data/ext/noderb_extension/libuv/src/ares/ares_free_hostent.c +39 -0
  237. data/ext/noderb_extension/libuv/src/ares/ares_free_string.c +25 -0
  238. data/ext/noderb_extension/libuv/src/ares/ares_gethostbyaddr.c +292 -0
  239. data/ext/noderb_extension/libuv/src/ares/ares_gethostbyname.c +515 -0
  240. data/ext/noderb_extension/libuv/src/ares/ares_getnameinfo.c +426 -0
  241. data/ext/noderb_extension/libuv/src/ares/ares_getopt.c +122 -0
  242. data/ext/noderb_extension/libuv/src/ares/ares_getopt.h +53 -0
  243. data/ext/noderb_extension/libuv/src/ares/ares_getsock.c +72 -0
  244. data/ext/noderb_extension/libuv/src/ares/ares_init.c +1665 -0
  245. data/ext/noderb_extension/libuv/src/ares/ares_ipv6.h +78 -0
  246. data/ext/noderb_extension/libuv/src/ares/ares_library_init.c +132 -0
  247. data/ext/noderb_extension/libuv/src/ares/ares_library_init.h +39 -0
  248. data/ext/noderb_extension/libuv/src/ares/ares_llist.c +86 -0
  249. data/ext/noderb_extension/libuv/src/ares/ares_llist.h +42 -0
  250. data/ext/noderb_extension/libuv/src/ares/ares_mkquery.c +195 -0
  251. data/ext/noderb_extension/libuv/src/ares/ares_nowarn.c +59 -0
  252. data/ext/noderb_extension/libuv/src/ares/ares_nowarn.h +24 -0
  253. data/ext/noderb_extension/libuv/src/ares/ares_options.c +253 -0
  254. data/ext/noderb_extension/libuv/src/ares/ares_parse_a_reply.c +260 -0
  255. data/ext/noderb_extension/libuv/src/ares/ares_parse_aaaa_reply.c +256 -0
  256. data/ext/noderb_extension/libuv/src/ares/ares_parse_mx_reply.c +170 -0
  257. data/ext/noderb_extension/libuv/src/ares/ares_parse_ns_reply.c +182 -0
  258. data/ext/noderb_extension/libuv/src/ares/ares_parse_ptr_reply.c +208 -0
  259. data/ext/noderb_extension/libuv/src/ares/ares_parse_srv_reply.c +179 -0
  260. data/ext/noderb_extension/libuv/src/ares/ares_parse_txt_reply.c +201 -0
  261. data/ext/noderb_extension/libuv/src/ares/ares_private.h +351 -0
  262. data/ext/noderb_extension/libuv/src/ares/ares_process.c +1296 -0
  263. data/ext/noderb_extension/libuv/src/ares/ares_query.c +183 -0
  264. data/ext/noderb_extension/libuv/src/ares/ares_rules.h +144 -0
  265. data/ext/noderb_extension/libuv/src/ares/ares_search.c +322 -0
  266. data/ext/noderb_extension/libuv/src/ares/ares_send.c +134 -0
  267. data/ext/noderb_extension/libuv/src/ares/ares_setup.h +191 -0
  268. data/ext/noderb_extension/libuv/src/ares/ares_strcasecmp.c +66 -0
  269. data/ext/noderb_extension/libuv/src/ares/ares_strcasecmp.h +30 -0
  270. data/ext/noderb_extension/libuv/src/ares/ares_strdup.c +42 -0
  271. data/ext/noderb_extension/libuv/src/ares/ares_strdup.h +26 -0
  272. data/ext/noderb_extension/libuv/src/ares/ares_strerror.c +56 -0
  273. data/ext/noderb_extension/libuv/src/ares/ares_timeout.c +80 -0
  274. data/ext/noderb_extension/libuv/src/ares/ares_version.c +11 -0
  275. data/ext/noderb_extension/libuv/src/ares/ares_writev.c +79 -0
  276. data/ext/noderb_extension/libuv/src/ares/ares_writev.h +36 -0
  277. data/ext/noderb_extension/libuv/src/ares/bitncmp.c +59 -0
  278. data/ext/noderb_extension/libuv/src/ares/bitncmp.h +26 -0
  279. data/ext/noderb_extension/libuv/src/ares/config_cygwin/ares_config.h +510 -0
  280. data/ext/noderb_extension/libuv/src/ares/config_darwin/ares_config.h +510 -0
  281. data/ext/noderb_extension/libuv/src/ares/config_freebsd/ares_config.h +510 -0
  282. data/ext/noderb_extension/libuv/src/ares/config_linux/ares_config.h +510 -0
  283. data/ext/noderb_extension/libuv/src/ares/config_openbsd/ares_config.h +510 -0
  284. data/ext/noderb_extension/libuv/src/ares/config_sunos/ares_config.h +510 -0
  285. data/ext/noderb_extension/libuv/src/ares/config_win32/ares_config.h +369 -0
  286. data/ext/noderb_extension/libuv/src/ares/get_ver.awk +35 -0
  287. data/ext/noderb_extension/libuv/src/ares/inet_net_pton.c +450 -0
  288. data/ext/noderb_extension/libuv/src/ares/inet_net_pton.h +31 -0
  289. data/ext/noderb_extension/libuv/src/ares/inet_ntop.c +232 -0
  290. data/ext/noderb_extension/libuv/src/ares/inet_ntop.h +27 -0
  291. data/ext/noderb_extension/libuv/src/ares/nameser.h +193 -0
  292. data/ext/noderb_extension/libuv/src/ares/setup_once.h +488 -0
  293. data/ext/noderb_extension/libuv/src/ares/windows_port.c +22 -0
  294. data/ext/noderb_extension/libuv/src/eio/Changes +63 -0
  295. data/ext/noderb_extension/libuv/src/eio/LICENSE +36 -0
  296. data/ext/noderb_extension/libuv/src/eio/Makefile.am +15 -0
  297. data/ext/noderb_extension/libuv/src/eio/aclocal.m4 +8957 -0
  298. data/ext/noderb_extension/libuv/src/eio/autogen.sh +3 -0
  299. data/ext/noderb_extension/libuv/src/eio/config.h.in +86 -0
  300. data/ext/noderb_extension/libuv/src/eio/config_cygwin.h +77 -0
  301. data/ext/noderb_extension/libuv/src/eio/config_darwin.h +137 -0
  302. data/ext/noderb_extension/libuv/src/eio/config_freebsd.h +78 -0
  303. data/ext/noderb_extension/libuv/src/eio/config_linux.h +101 -0
  304. data/ext/noderb_extension/libuv/src/eio/config_sunos.h +81 -0
  305. data/ext/noderb_extension/libuv/src/eio/configure.ac +22 -0
  306. data/ext/noderb_extension/libuv/src/eio/demo.c +194 -0
  307. data/ext/noderb_extension/libuv/src/eio/ecb.h +370 -0
  308. data/ext/noderb_extension/libuv/src/eio/eio.3 +3428 -0
  309. data/ext/noderb_extension/libuv/src/eio/eio.c +2562 -0
  310. data/ext/noderb_extension/libuv/src/eio/eio.pod +969 -0
  311. data/ext/noderb_extension/libuv/src/eio/libeio.m4 +195 -0
  312. data/ext/noderb_extension/libuv/src/eio/xthread.h +164 -0
  313. data/ext/noderb_extension/libuv/src/ev/Changes +388 -0
  314. data/ext/noderb_extension/libuv/src/ev/LICENSE +36 -0
  315. data/ext/noderb_extension/libuv/src/ev/Makefile.am +18 -0
  316. data/ext/noderb_extension/libuv/src/ev/Makefile.in +771 -0
  317. data/ext/noderb_extension/libuv/src/ev/README +58 -0
  318. data/ext/noderb_extension/libuv/src/ev/aclocal.m4 +8957 -0
  319. data/ext/noderb_extension/libuv/src/ev/autogen.sh +6 -0
  320. data/ext/noderb_extension/libuv/src/ev/config.guess +1526 -0
  321. data/ext/noderb_extension/libuv/src/ev/config.h.in +125 -0
  322. data/ext/noderb_extension/libuv/src/ev/config.sub +1658 -0
  323. data/ext/noderb_extension/libuv/src/ev/config_cygwin.h +123 -0
  324. data/ext/noderb_extension/libuv/src/ev/config_darwin.h +122 -0
  325. data/ext/noderb_extension/libuv/src/ev/config_freebsd.h +120 -0
  326. data/ext/noderb_extension/libuv/src/ev/config_linux.h +130 -0
  327. data/ext/noderb_extension/libuv/src/ev/config_sunos.h +122 -0
  328. data/ext/noderb_extension/libuv/src/ev/configure +13037 -0
  329. data/ext/noderb_extension/libuv/src/ev/configure.ac +18 -0
  330. data/ext/noderb_extension/libuv/src/ev/depcomp +630 -0
  331. data/ext/noderb_extension/libuv/src/ev/ev++.h +816 -0
  332. data/ext/noderb_extension/libuv/src/ev/ev.3 +5311 -0
  333. data/ext/noderb_extension/libuv/src/ev/ev.c +3913 -0
  334. data/ext/noderb_extension/libuv/src/ev/ev.pod +5243 -0
  335. data/ext/noderb_extension/libuv/src/ev/ev_epoll.c +266 -0
  336. data/ext/noderb_extension/libuv/src/ev/ev_kqueue.c +198 -0
  337. data/ext/noderb_extension/libuv/src/ev/ev_poll.c +148 -0
  338. data/ext/noderb_extension/libuv/src/ev/ev_port.c +179 -0
  339. data/ext/noderb_extension/libuv/src/ev/ev_select.c +310 -0
  340. data/ext/noderb_extension/libuv/src/ev/ev_vars.h +203 -0
  341. data/ext/noderb_extension/libuv/src/ev/ev_win32.c +153 -0
  342. data/ext/noderb_extension/libuv/src/ev/ev_wrap.h +196 -0
  343. data/ext/noderb_extension/libuv/src/ev/event.c +402 -0
  344. data/ext/noderb_extension/libuv/src/ev/event.h +170 -0
  345. data/ext/noderb_extension/libuv/src/ev/install-sh +294 -0
  346. data/ext/noderb_extension/libuv/src/ev/libev.m4 +39 -0
  347. data/ext/noderb_extension/libuv/src/ev/ltmain.sh +8413 -0
  348. data/ext/noderb_extension/libuv/src/ev/missing +336 -0
  349. data/ext/noderb_extension/libuv/src/ev/mkinstalldirs +111 -0
  350. data/ext/noderb_extension/libuv/src/uv-common.c +172 -0
  351. data/ext/noderb_extension/libuv/src/uv-common.h +53 -0
  352. data/ext/noderb_extension/libuv/src/uv-cygwin.c +52 -0
  353. data/ext/noderb_extension/libuv/src/uv-darwin.c +64 -0
  354. data/ext/noderb_extension/libuv/src/uv-eio.c +113 -0
  355. data/ext/noderb_extension/libuv/src/uv-eio.h +13 -0
  356. data/ext/noderb_extension/libuv/src/uv-freebsd.c +65 -0
  357. data/ext/noderb_extension/libuv/src/uv-linux.c +51 -0
  358. data/ext/noderb_extension/libuv/src/uv-sunos.c +60 -0
  359. data/ext/noderb_extension/libuv/src/uv-unix.c +2408 -0
  360. data/ext/noderb_extension/libuv/src/win/async.c +129 -0
  361. data/ext/noderb_extension/libuv/src/win/cares.c +304 -0
  362. data/ext/noderb_extension/libuv/src/win/core.c +155 -0
  363. data/ext/noderb_extension/libuv/src/win/error.c +140 -0
  364. data/ext/noderb_extension/libuv/src/win/getaddrinfo.c +341 -0
  365. data/ext/noderb_extension/libuv/src/win/handle.c +176 -0
  366. data/ext/noderb_extension/libuv/src/win/internal.h +237 -0
  367. data/ext/noderb_extension/libuv/src/win/loop-watcher.c +128 -0
  368. data/ext/noderb_extension/libuv/src/win/pipe.c +828 -0
  369. data/ext/noderb_extension/libuv/src/win/process.c +936 -0
  370. data/ext/noderb_extension/libuv/src/win/req.c +141 -0
  371. data/ext/noderb_extension/libuv/src/win/stdio.c +75 -0
  372. data/ext/noderb_extension/libuv/src/win/stream.c +149 -0
  373. data/ext/noderb_extension/libuv/src/win/tcp.c +895 -0
  374. data/ext/noderb_extension/libuv/src/win/timer.c +269 -0
  375. data/ext/noderb_extension/libuv/src/win/util.c +82 -0
  376. data/ext/noderb_extension/libuv/test/benchmark-ares.c +117 -0
  377. data/ext/noderb_extension/libuv/test/benchmark-getaddrinfo.c +90 -0
  378. data/ext/noderb_extension/libuv/test/benchmark-list.h +77 -0
  379. data/ext/noderb_extension/libuv/test/benchmark-ping-pongs.c +210 -0
  380. data/ext/noderb_extension/libuv/test/benchmark-pound.c +237 -0
  381. data/ext/noderb_extension/libuv/test/benchmark-pump.c +459 -0
  382. data/ext/noderb_extension/libuv/test/benchmark-sizes.c +39 -0
  383. data/ext/noderb_extension/libuv/test/benchmark-spawn.c +154 -0
  384. data/ext/noderb_extension/libuv/test/dns-server.c +323 -0
  385. data/ext/noderb_extension/libuv/test/echo-server.c +299 -0
  386. data/ext/noderb_extension/libuv/test/run-benchmarks.c +64 -0
  387. data/ext/noderb_extension/libuv/test/run-tests.c +82 -0
  388. data/ext/noderb_extension/libuv/test/runner-unix.c +335 -0
  389. data/ext/noderb_extension/libuv/test/runner-unix.h +36 -0
  390. data/ext/noderb_extension/libuv/test/runner-win.c +343 -0
  391. data/ext/noderb_extension/libuv/test/runner-win.h +42 -0
  392. data/ext/noderb_extension/libuv/test/runner.c +311 -0
  393. data/ext/noderb_extension/libuv/test/runner.h +155 -0
  394. data/ext/noderb_extension/libuv/test/task.h +111 -0
  395. data/ext/noderb_extension/libuv/test/test-async.c +218 -0
  396. data/ext/noderb_extension/libuv/test/test-callback-stack.c +205 -0
  397. data/ext/noderb_extension/libuv/test/test-connection-fail.c +149 -0
  398. data/ext/noderb_extension/libuv/test/test-delayed-accept.c +198 -0
  399. data/ext/noderb_extension/libuv/test/test-fail-always.c +29 -0
  400. data/ext/noderb_extension/libuv/test/test-get-currentexe.c +53 -0
  401. data/ext/noderb_extension/libuv/test/test-getaddrinfo.c +110 -0
  402. data/ext/noderb_extension/libuv/test/test-gethostbyname.c +192 -0
  403. data/ext/noderb_extension/libuv/test/test-getsockname.c +196 -0
  404. data/ext/noderb_extension/libuv/test/test-hrtime.c +51 -0
  405. data/ext/noderb_extension/libuv/test/test-idle.c +83 -0
  406. data/ext/noderb_extension/libuv/test/test-list.h +165 -0
  407. data/ext/noderb_extension/libuv/test/test-loop-handles.c +361 -0
  408. data/ext/noderb_extension/libuv/test/test-pass-always.c +28 -0
  409. data/ext/noderb_extension/libuv/test/test-ping-pong.c +256 -0
  410. data/ext/noderb_extension/libuv/test/test-pipe-bind-error.c +148 -0
  411. data/ext/noderb_extension/libuv/test/test-ref.c +91 -0
  412. data/ext/noderb_extension/libuv/test/test-shutdown-eof.c +183 -0
  413. data/ext/noderb_extension/libuv/test/test-spawn.c +345 -0
  414. data/ext/noderb_extension/libuv/test/test-tcp-bind-error.c +204 -0
  415. data/ext/noderb_extension/libuv/test/test-tcp-bind6-error.c +164 -0
  416. data/ext/noderb_extension/libuv/test/test-tcp-writealot.c +198 -0
  417. data/ext/noderb_extension/libuv/test/test-timer-again.c +141 -0
  418. data/ext/noderb_extension/libuv/test/test-timer.c +134 -0
  419. data/ext/noderb_extension/noderb.c +340 -0
  420. data/ext/noderb_extension/noderb.h +2 -0
  421. data/lib/noderb/connection.rb +21 -0
  422. data/lib/noderb/process.rb +17 -0
  423. data/lib/noderb.rb +25 -0
  424. metadata +470 -0
@@ -0,0 +1,783 @@
1
+ This file documents non-portable functions and other issues.
2
+
3
+ Non-portable functions included in pthreads-win32
4
+ -------------------------------------------------
5
+
6
+ BOOL
7
+ pthread_win32_test_features_np(int mask)
8
+
9
+ This routine allows an application to check which
10
+ run-time auto-detected features are available within
11
+ the library.
12
+
13
+ The possible features are:
14
+
15
+ PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE
16
+ Return TRUE if the native version of
17
+ InterlockedCompareExchange() is being used.
18
+ This feature is not meaningful in recent
19
+ library versions as MSVC builds only support
20
+ system implemented ICE. Note that all Mingw
21
+ builds use inlined asm versions of all the
22
+ Interlocked routines.
23
+ PTW32_ALERTABLE_ASYNC_CANCEL
24
+ Return TRUE is the QueueUserAPCEx package
25
+ QUSEREX.DLL is available and the AlertDrv.sys
26
+ driver is loaded into Windows, providing
27
+ alertable (pre-emptive) asyncronous threads
28
+ cancelation. If this feature returns FALSE
29
+ then the default async cancel scheme is in
30
+ use, which cannot cancel blocked threads.
31
+
32
+ Features may be Or'ed into the mask parameter, in which case
33
+ the routine returns TRUE if any of the Or'ed features would
34
+ return TRUE. At this stage it doesn't make sense to Or features
35
+ but it may some day.
36
+
37
+
38
+ void *
39
+ pthread_timechange_handler_np(void *)
40
+
41
+ To improve tolerance against operator or time service
42
+ initiated system clock changes.
43
+
44
+ This routine can be called by an application when it
45
+ receives a WM_TIMECHANGE message from the system. At
46
+ present it broadcasts all condition variables so that
47
+ waiting threads can wake up and re-evaluate their
48
+ conditions and restart their timed waits if required.
49
+
50
+ It has the same return type and argument type as a
51
+ thread routine so that it may be called directly
52
+ through pthread_create(), i.e. as a separate thread.
53
+
54
+ Parameters
55
+
56
+ Although a parameter must be supplied, it is ignored.
57
+ The value NULL can be used.
58
+
59
+ Return values
60
+
61
+ It can return an error EAGAIN to indicate that not
62
+ all condition variables were broadcast for some reason.
63
+ Otherwise, 0 is returned.
64
+
65
+ If run as a thread, the return value is returned
66
+ through pthread_join().
67
+
68
+ The return value should be cast to an integer.
69
+
70
+
71
+ HANDLE
72
+ pthread_getw32threadhandle_np(pthread_t thread);
73
+
74
+ Returns the win32 thread handle that the POSIX
75
+ thread "thread" is running as.
76
+
77
+ Applications can use the win32 handle to set
78
+ win32 specific attributes of the thread.
79
+
80
+ DWORD
81
+ pthread_getw32threadid_np (pthread_t thread)
82
+
83
+ Returns the Windows native thread ID that the POSIX
84
+ thread "thread" is running as.
85
+
86
+ Only valid when the library is built where
87
+ ! (defined(__MINGW64__) || defined(__MINGW32__)) || defined (__MSVCRT__) || defined (__DMC__)
88
+ and otherwise returns 0.
89
+
90
+
91
+ int
92
+ pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind)
93
+
94
+ int
95
+ pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind)
96
+
97
+ These two routines are included for Linux compatibility
98
+ and are direct equivalents to the standard routines
99
+ pthread_mutexattr_settype
100
+ pthread_mutexattr_gettype
101
+
102
+ pthread_mutexattr_setkind_np accepts the following
103
+ mutex kinds:
104
+ PTHREAD_MUTEX_FAST_NP
105
+ PTHREAD_MUTEX_ERRORCHECK_NP
106
+ PTHREAD_MUTEX_RECURSIVE_NP
107
+
108
+ These are really just equivalent to (respectively):
109
+ PTHREAD_MUTEX_NORMAL
110
+ PTHREAD_MUTEX_ERRORCHECK
111
+ PTHREAD_MUTEX_RECURSIVE
112
+
113
+ int
114
+ pthread_delay_np (const struct timespec *interval);
115
+
116
+ This routine causes a thread to delay execution for a specific period of time.
117
+ This period ends at the current time plus the specified interval. The routine
118
+ will not return before the end of the period is reached, but may return an
119
+ arbitrary amount of time after the period has gone by. This can be due to
120
+ system load, thread priorities, and system timer granularity.
121
+
122
+ Specifying an interval of zero (0) seconds and zero (0) nanoseconds is
123
+ allowed and can be used to force the thread to give up the processor or to
124
+ deliver a pending cancelation request.
125
+
126
+ This routine is a cancelation point.
127
+
128
+ The timespec structure contains the following two fields:
129
+
130
+ tv_sec is an integer number of seconds.
131
+ tv_nsec is an integer number of nanoseconds.
132
+
133
+ Return Values
134
+
135
+ If an error condition occurs, this routine returns an integer value
136
+ indicating the type of error. Possible return values are as follows:
137
+
138
+ 0 Successful completion.
139
+ [EINVAL] The value specified by interval is invalid.
140
+
141
+ int
142
+ pthread_num_processors_np (void)
143
+
144
+ This routine (found on HPUX systems) returns the number of processors
145
+ in the system. This implementation actually returns the number of
146
+ processors available to the process, which can be a lower number
147
+ than the system's number, depending on the process's affinity mask.
148
+
149
+ BOOL
150
+ pthread_win32_process_attach_np (void);
151
+
152
+ BOOL
153
+ pthread_win32_process_detach_np (void);
154
+
155
+ BOOL
156
+ pthread_win32_thread_attach_np (void);
157
+
158
+ BOOL
159
+ pthread_win32_thread_detach_np (void);
160
+
161
+ These functions contain the code normally run via dllMain
162
+ when the library is used as a dll but which need to be
163
+ called explicitly by an application when the library
164
+ is statically linked. As of version 2.9.0 of the library, static
165
+ builds using either MSC or GCC will call pthread_win32_process_*
166
+ automatically at application startup and exit respectively.
167
+
168
+ Otherwise, you will need to call pthread_win32_process_attach_np()
169
+ before you can call any pthread routines when statically linking.
170
+ You should call pthread_win32_process_detach_np() before
171
+ exiting your application to clean up.
172
+
173
+ pthread_win32_thread_attach_np() is currently a no-op, but
174
+ pthread_win32_thread_detach_np() is needed to clean up
175
+ the implicit pthread handle that is allocated to a Win32 thread if
176
+ it calls any pthreads routines. Call this routine when the
177
+ Win32 thread exits.
178
+
179
+ Threads created through pthread_create() do not need to call
180
+ pthread_win32_thread_detach_np().
181
+
182
+ These functions invariably return TRUE except for
183
+ pthread_win32_process_attach_np() which will return FALSE
184
+ if pthreads-win32 initialisation fails.
185
+
186
+ int
187
+ pthreadCancelableWait (HANDLE waitHandle);
188
+
189
+ int
190
+ pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
191
+
192
+ These two functions provide hooks into the pthread_cancel
193
+ mechanism that will allow you to wait on a Windows handle
194
+ and make it a cancellation point. Both functions block
195
+ until either the given w32 handle is signaled, or
196
+ pthread_cancel has been called. It is implemented using
197
+ WaitForMultipleObjects on 'waitHandle' and a manually
198
+ reset w32 event used to implement pthread_cancel.
199
+
200
+
201
+ Non-portable issues
202
+ -------------------
203
+
204
+ Thread priority
205
+
206
+ POSIX defines a single contiguous range of numbers that determine a
207
+ thread's priority. Win32 defines priority classes and priority
208
+ levels relative to these classes. Classes are simply priority base
209
+ levels that the defined priority levels are relative to such that,
210
+ changing a process's priority class will change the priority of all
211
+ of it's threads, while the threads retain the same relativity to each
212
+ other.
213
+
214
+ A Win32 system defines a single contiguous monotonic range of values
215
+ that define system priority levels, just like POSIX. However, Win32
216
+ restricts individual threads to a subset of this range on a
217
+ per-process basis.
218
+
219
+ The following table shows the base priority levels for combinations
220
+ of priority class and priority value in Win32.
221
+
222
+ Process Priority Class Thread Priority Level
223
+ -----------------------------------------------------------------
224
+ 1 IDLE_PRIORITY_CLASS THREAD_PRIORITY_IDLE
225
+ 1 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE
226
+ 1 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE
227
+ 1 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE
228
+ 1 HIGH_PRIORITY_CLASS THREAD_PRIORITY_IDLE
229
+ 2 IDLE_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
230
+ 3 IDLE_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
231
+ 4 IDLE_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
232
+ 4 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
233
+ 5 IDLE_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
234
+ 5 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
235
+ 5 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
236
+ 6 IDLE_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
237
+ 6 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
238
+ 6 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
239
+ 7 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
240
+ 7 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
241
+ 7 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
242
+ 8 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
243
+ 8 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
244
+ 8 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
245
+ 8 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
246
+ 9 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
247
+ 9 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
248
+ 9 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
249
+ 10 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
250
+ 10 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
251
+ 11 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
252
+ 11 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
253
+ 11 HIGH_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
254
+ 12 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
255
+ 12 HIGH_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
256
+ 13 HIGH_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
257
+ 14 HIGH_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
258
+ 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
259
+ 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL
260
+ 15 IDLE_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL
261
+ 15 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL
262
+ 15 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL
263
+ 15 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL
264
+ 16 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_IDLE
265
+ 17 REALTIME_PRIORITY_CLASS -7
266
+ 18 REALTIME_PRIORITY_CLASS -6
267
+ 19 REALTIME_PRIORITY_CLASS -5
268
+ 20 REALTIME_PRIORITY_CLASS -4
269
+ 21 REALTIME_PRIORITY_CLASS -3
270
+ 22 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_LOWEST
271
+ 23 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL
272
+ 24 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_NORMAL
273
+ 25 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL
274
+ 26 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST
275
+ 27 REALTIME_PRIORITY_CLASS 3
276
+ 28 REALTIME_PRIORITY_CLASS 4
277
+ 29 REALTIME_PRIORITY_CLASS 5
278
+ 30 REALTIME_PRIORITY_CLASS 6
279
+ 31 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL
280
+
281
+ Windows NT: Values -7, -6, -5, -4, -3, 3, 4, 5, and 6 are not supported.
282
+
283
+
284
+ As you can see, the real priority levels available to any individual
285
+ Win32 thread are non-contiguous.
286
+
287
+ An application using pthreads-win32 should not make assumptions about
288
+ the numbers used to represent thread priority levels, except that they
289
+ are monotonic between the values returned by sched_get_priority_min()
290
+ and sched_get_priority_max(). E.g. Windows 95, 98, NT, 2000, XP make
291
+ available a non-contiguous range of numbers between -15 and 15, while
292
+ at least one version of WinCE (3.0) defines the minimum priority
293
+ (THREAD_PRIORITY_LOWEST) as 5, and the maximum priority
294
+ (THREAD_PRIORITY_HIGHEST) as 1.
295
+
296
+ Internally, pthreads-win32 maps any priority levels between
297
+ THREAD_PRIORITY_IDLE and THREAD_PRIORITY_LOWEST to THREAD_PRIORITY_LOWEST,
298
+ or between THREAD_PRIORITY_TIME_CRITICAL and THREAD_PRIORITY_HIGHEST to
299
+ THREAD_PRIORITY_HIGHEST. Currently, this also applies to
300
+ REALTIME_PRIORITY_CLASSi even if levels -7, -6, -5, -4, -3, 3, 4, 5, and 6
301
+ are supported.
302
+
303
+ If it wishes, a Win32 application using pthreads-win32 can use the Win32
304
+ defined priority macros THREAD_PRIORITY_IDLE through
305
+ THREAD_PRIORITY_TIME_CRITICAL.
306
+
307
+
308
+ The opacity of the pthread_t datatype
309
+ -------------------------------------
310
+ and possible solutions for portable null/compare/hash, etc
311
+ ----------------------------------------------------------
312
+
313
+ Because pthread_t is an opague datatype an implementation is permitted to define
314
+ pthread_t in any way it wishes. That includes defining some bits, if it is
315
+ scalar, or members, if it is an aggregate, to store information that may be
316
+ extra to the unique identifying value of the ID. As a result, pthread_t values
317
+ may not be directly comparable.
318
+
319
+ If you want your code to be portable you must adhere to the following contraints:
320
+
321
+ 1) Don't assume it is a scalar data type, e.g. an integer or pointer value. There
322
+ are several other implementations where pthread_t is also a struct. See our FAQ
323
+ Question 11 for our reasons for defining pthread_t as a struct.
324
+
325
+ 2) You must not compare them using relational or equality operators. You must use
326
+ the API function pthread_equal() to test for equality.
327
+
328
+ 3) Never attempt to reference individual members.
329
+
330
+
331
+ The problem
332
+
333
+ Certain applications would like to be able to access only the 'pure' pthread_t
334
+ id values, primarily to use as keys into data structures to manage threads or
335
+ thread-related data, but this is not possible in a maximally portable and
336
+ standards compliant way for current POSIX threads implementations.
337
+
338
+ For implementations that define pthread_t as a scalar, programmers often employ
339
+ direct relational and equality operators on pthread_t. This code will break when
340
+ ported to an implementation that defines pthread_t as an aggregate type.
341
+
342
+ For implementations that define pthread_t as an aggregate, e.g. a struct,
343
+ programmers can use memcmp etc., but then face the prospect that the struct may
344
+ include alignment padding bytes or bits as well as extra implementation-specific
345
+ members that are not part of the unique identifying value.
346
+
347
+ [While this is not currently the case for pthreads-win32, opacity also
348
+ means that an implementation is free to change the definition, which should
349
+ generally only require that applications be recompiled and relinked, not
350
+ rewritten.]
351
+
352
+
353
+ Doesn't the compiler take care of padding?
354
+
355
+ The C89 and later standards only effectively guarrantee element-by-element
356
+ equivalence following an assignment or pass by value of a struct or union,
357
+ therefore undefined areas of any two otherwise equivalent pthread_t instances
358
+ can still compare differently, e.g. attempting to compare two such pthread_t
359
+ variables byte-by-byte, e.g. memcmp(&t1, &t2, sizeof(pthread_t) may give an
360
+ incorrect result. In practice I'm reasonably confident that compilers routinely
361
+ also copy the padding bytes, mainly because assignment of unions would be far
362
+ too complicated otherwise. But it just isn't guarranteed by the standard.
363
+
364
+ Illustration:
365
+
366
+ We have two thread IDs t1 and t2
367
+
368
+ pthread_t t1, t2;
369
+
370
+ In an application we create the threads and intend to store the thread IDs in an
371
+ ordered data structure (linked list, tree, etc) so we need to be able to compare
372
+ them in order to insert them initially and also to traverse.
373
+
374
+ Suppose pthread_t contains undefined padding bits and our compiler copies our
375
+ pthread_t [struct] element-by-element, then for the assignment:
376
+
377
+ pthread_t temp = t1;
378
+
379
+ temp and t1 will be equivalent and correct but a byte-for-byte comparison such as
380
+ memcmp(&temp, &t1, sizeof(pthread_t)) == 0 may not return true as we expect because
381
+ the undefined bits may not have the same values in the two variable instances.
382
+
383
+ Similarly if passing by value under the same conditions.
384
+
385
+ If, on the other hand, the undefined bits are at least constant through every
386
+ assignment and pass-by-value then the byte-for-byte comparison
387
+ memcmp(&temp, &t1, sizeof(pthread_t)) == 0 will always return the expected result.
388
+ How can we force the behaviour we need?
389
+
390
+
391
+ Solutions
392
+
393
+ Adding new functions to the standard API or as non-portable extentions is
394
+ the only reliable and portable way to provide the necessary operations.
395
+ Remember also that POSIX is not tied to the C language. The most common
396
+ functions that have been suggested are:
397
+
398
+ pthread_null()
399
+ pthread_compare()
400
+ pthread_hash()
401
+
402
+ A single more general purpose function could also be defined as a
403
+ basis for at least the last two of the above functions.
404
+
405
+ First we need to list the freedoms and constraints with restpect
406
+ to pthread_t so that we can be sure our solution is compatible with the
407
+ standard.
408
+
409
+ What is known or may be deduced from the standard:
410
+ 1) pthread_t must be able to be passed by value, so it must be a single object.
411
+ 2) from (1) it must be copyable so cannot embed thread-state information, locks
412
+ or other volatile objects required to manage the thread it associates with.
413
+ 3) pthread_t may carry additional information, e.g. for debugging or to manage
414
+ itself.
415
+ 4) there is an implicit requirement that the size of pthread_t is determinable
416
+ at compile-time and size-invariant, because it must be able to copy the object
417
+ (i.e. through assignment and pass-by-value). Such copies must be genuine
418
+ duplicates, not merely a copy of a pointer to a common instance such as
419
+ would be the case if pthread_t were defined as an array.
420
+
421
+
422
+ Suppose we define the following function:
423
+
424
+ /* This function shall return it's argument */
425
+ pthread_t* pthread_normalize(pthread_t* thread);
426
+
427
+ For scalar or aggregate pthread_t types this function would simply zero any bits
428
+ within the pthread_t that don't uniquely identify the thread, including padding,
429
+ such that client code can return consistent results from operations done on the
430
+ result. If the additional bits are a pointer to an associate structure then
431
+ this function would ensure that the memory used to store that associate
432
+ structure does not leak. After normalization the following compare would be
433
+ valid and repeatable:
434
+
435
+ memcmp(pthread_normalize(&t1),pthread_normalize(&t2),sizeof(pthread_t))
436
+
437
+ Note 1: such comparisons are intended merely to order and sort pthread_t values
438
+ and allow them to index various data structures. They are not intended to reveal
439
+ anything about the relationships between threads, like startup order.
440
+
441
+ Note 2: the normalized pthread_t is also a valid pthread_t that uniquely
442
+ identifies the same thread.
443
+
444
+ Advantages:
445
+ 1) In most existing implementations this function would reduce to a no-op that
446
+ emits no additional instructions, i.e after in-lining or optimisation, or if
447
+ defined as a macro:
448
+ #define pthread_normalise(tptr) (tptr)
449
+
450
+ 2) This single function allows an application to portably derive
451
+ application-level versions of any of the other required functions.
452
+
453
+ 3) It is a generic function that could enable unanticipated uses.
454
+
455
+ Disadvantages:
456
+ 1) Less efficient than dedicated compare or hash functions for implementations
457
+ that include significant extra non-id elements in pthread_t.
458
+
459
+ 2) Still need to be concerned about padding if copying normalized pthread_t.
460
+ See the later section on defining pthread_t to neutralise padding issues.
461
+
462
+ Generally a pthread_t may need to be normalized every time it is used,
463
+ which could have a significant impact. However, this is a design decision
464
+ for the implementor in a competitive environment. An implementation is free
465
+ to define a pthread_t in a way that minimises or eliminates padding or
466
+ renders this function a no-op.
467
+
468
+ Hazards:
469
+ 1) Pass-by-reference directly modifies 'thread' so the application must
470
+ synchronise access or ensure that the pointer refers to a copy. The alternative
471
+ of pass-by-value/return-by-value was considered but then this requires two copy
472
+ operations, disadvantaging implementations where this function is not a no-op
473
+ in terms of speed of execution. This function is intended to be used in high
474
+ frequency situations and needs to be efficient, or at least not unnecessarily
475
+ inefficient. The alternative also sits awkwardly with functions like memcmp.
476
+
477
+ 2) [Non-compliant] code that uses relational and equality operators on
478
+ arithmetic or pointer style pthread_t types would need to be rewritten, but it
479
+ should be rewritten anyway.
480
+
481
+
482
+ C implementation of null/compare/hash functions using pthread_normalize():
483
+
484
+ /* In pthread.h */
485
+ pthread_t* pthread_normalize(pthread_t* thread);
486
+
487
+ /* In user code */
488
+ /* User-level bitclear function - clear bits in loc corresponding to mask */
489
+ void* bitclear (void* loc, void* mask, size_t count);
490
+
491
+ typedef unsigned int hash_t;
492
+
493
+ /* User-level hash function */
494
+ hash_t hash(void* ptr, size_t count);
495
+
496
+ /*
497
+ * User-level pthr_null function - modifies the origin thread handle.
498
+ * The concept of a null pthread_t is highly implementation dependent
499
+ * and this design may be far from the mark. For example, in an
500
+ * implementation "null" may mean setting a special value inside one
501
+ * element of pthread_t to mean "INVALID". However, if that value was zero and
502
+ * formed part of the id component then we may get away with this design.
503
+ */
504
+ pthread_t* pthr_null(pthread_t* tp)
505
+ {
506
+ /*
507
+ * This should have the same effect as memset(tp, 0, sizeof(pthread_t))
508
+ * We're just showing that we can do it.
509
+ */
510
+ void* p = (void*) pthread_normalize(tp);
511
+ return (pthread_t*) bitclear(p, p, sizeof(pthread_t));
512
+ }
513
+
514
+ /*
515
+ * Safe user-level pthr_compare function - modifies temporary thread handle copies
516
+ */
517
+ int pthr_compare_safe(pthread_t thread1, pthread_t thread2)
518
+ {
519
+ return memcmp(pthread_normalize(&thread1), pthread_normalize(&thread2), sizeof(pthread_t));
520
+ }
521
+
522
+ /*
523
+ * Fast user-level pthr_compare function - modifies origin thread handles
524
+ */
525
+ int pthr_compare_fast(pthread_t* thread1, pthread_t* thread2)
526
+ {
527
+ return memcmp(pthread_normalize(&thread1), pthread_normalize(&thread2), sizeof(pthread_t));
528
+ }
529
+
530
+ /*
531
+ * Safe user-level pthr_hash function - modifies temporary thread handle copy
532
+ */
533
+ hash_t pthr_hash_safe(pthread_t thread)
534
+ {
535
+ return hash((void *) pthread_normalize(&thread), sizeof(pthread_t));
536
+ }
537
+
538
+ /*
539
+ * Fast user-level pthr_hash function - modifies origin thread handle
540
+ */
541
+ hash_t pthr_hash_fast(pthread_t thread)
542
+ {
543
+ return hash((void *) pthread_normalize(&thread), sizeof(pthread_t));
544
+ }
545
+
546
+ /* User-level bitclear function - modifies the origin array */
547
+ void* bitclear(void* loc, void* mask, size_t count)
548
+ {
549
+ int i;
550
+ for (i=0; i < count; i++) {
551
+ (unsigned char) *loc++ &= ~((unsigned char) *mask++);
552
+ }
553
+ }
554
+
555
+ /* Donald Knuth hash */
556
+ hash_t hash(void* str, size_t count)
557
+ {
558
+ hash_t hash = (hash_t) count;
559
+ unsigned int i = 0;
560
+
561
+ for(i = 0; i < len; str++, i++)
562
+ {
563
+ hash = ((hash << 5) ^ (hash >> 27)) ^ (*str);
564
+ }
565
+ return hash;
566
+ }
567
+
568
+ /* Example of advantage point (3) - split a thread handle into its id and non-id values */
569
+ pthread_t id = thread, non-id = thread;
570
+ bitclear((void*) &non-id, (void*) pthread_normalize(&id), sizeof(pthread_t));
571
+
572
+
573
+ A pthread_t type change proposal to neutralise the effects of padding
574
+
575
+ Even if pthread_nornalize() is available, padding is still a problem because
576
+ the standard only garrantees element-by-element equivalence through
577
+ copy operations (assignment and pass-by-value). So padding bit values can
578
+ still change randomly after calls to pthread_normalize().
579
+
580
+ [I suspect that most compilers take the easy path and always byte-copy anyway,
581
+ partly because it becomes too complex to do (e.g. unions that contain sub-aggregates)
582
+ but also because programmers can easily design their aggregates to minimise and
583
+ often eliminate padding].
584
+
585
+ How can we eliminate the problem of padding bytes in structs? Could
586
+ defining pthread_t as a union rather than a struct provide a solution?
587
+
588
+ In fact, the Linux pthread.h defines most of it's pthread_*_t objects (but not
589
+ pthread_t itself) as unions, possibly for this and/or other reasons. We'll
590
+ borrow some element naming from there but the ideas themselves are well known
591
+ - the __align element used to force alignment of the union comes from K&R's
592
+ storage allocator example.
593
+
594
+ /* Essentially our current pthread_t renamed */
595
+ typedef struct {
596
+ struct thread_state_t * __p;
597
+ long __x; /* sequence counter */
598
+ } thread_id_t;
599
+
600
+ Ensuring that the last element in the above struct is a long ensures that the
601
+ overall struct size is a multiple of sizeof(long), so there should be no trailing
602
+ padding in this struct or the union we define below.
603
+ (Later we'll see that we can handle internal but not trailing padding.)
604
+
605
+ /* New pthread_t */
606
+ typedef union {
607
+ char __size[sizeof(thread_id_t)]; /* array as the first element */
608
+ thread_id_t __tid;
609
+ long __align; /* Ensure that the union starts on long boundary */
610
+ } pthread_t;
611
+
612
+ This guarrantees that, during an assignment or pass-by-value, the compiler copies
613
+ every byte in our thread_id_t because the compiler guarrantees that the __size
614
+ array, which we have ensured is the equal-largest element in the union, retains
615
+ equivalence.
616
+
617
+ This means that pthread_t values stored, assigned and passed by value will at least
618
+ carry the value of any undefined padding bytes along and therefore ensure that
619
+ those values remain consistent. Our comparisons will return consistent results and
620
+ our hashes of [zero initialised] pthread_t values will also return consistent
621
+ results.
622
+
623
+ We have also removed the need for a pthread_null() function; we can initialise
624
+ at declaration time or easily create our own const pthread_t to use in assignments
625
+ later:
626
+
627
+ const pthread_t null_tid = {0}; /* braces are required */
628
+
629
+ pthread_t t;
630
+ ...
631
+ t = null_tid;
632
+
633
+
634
+ Note that we don't have to explicitly make use of the __size array at all. It's
635
+ there just to force the compiler behaviour we want.
636
+
637
+
638
+ Partial solutions without a pthread_normalize function
639
+
640
+
641
+ An application-level pthread_null and pthread_compare proposal
642
+ (and pthread_hash proposal by extention)
643
+
644
+ In order to deal with the problem of scalar/aggregate pthread_t type disparity in
645
+ portable code I suggest using an old-fashioned union, e.g.:
646
+
647
+ Contraints:
648
+ - there is no padding, or padding values are preserved through assignment and
649
+ pass-by-value (see above);
650
+ - there are no extra non-id values in the pthread_t.
651
+
652
+
653
+ Example 1: A null initialiser for pthread_t variables...
654
+
655
+ typedef union {
656
+ unsigned char b[sizeof(pthread_t)];
657
+ pthread_t t;
658
+ } init_t;
659
+
660
+ const init_t initial = {0};
661
+
662
+ pthread_t tid = initial.t; /* init tid to all zeroes */
663
+
664
+
665
+ Example 2: A comparison function for pthread_t values
666
+
667
+ typedef union {
668
+ unsigned char b[sizeof(pthread_t)];
669
+ pthread_t t;
670
+ } pthcmp_t;
671
+
672
+ int pthcmp(pthread_t left, pthread_t right)
673
+ {
674
+ /*
675
+ * Compare two pthread handles in a way that imposes a repeatable but arbitrary
676
+ * ordering on them.
677
+ * I.e. given the same set of pthread_t handles the ordering should be the same
678
+ * each time but the order has no particular meaning other than that. E.g.
679
+ * the ordering does not imply the thread start sequence, or any other
680
+ * relationship between threads.
681
+ *
682
+ * Return values are:
683
+ * 1 : left is greater than right
684
+ * 0 : left is equal to right
685
+ * -1 : left is less than right
686
+ */
687
+ int i;
688
+ pthcmp_t L, R;
689
+ L.t = left;
690
+ R.t = right;
691
+ for (i = 0; i < sizeof(pthread_t); i++)
692
+ {
693
+ if (L.b[i] > R.b[i])
694
+ return 1;
695
+ else if (L.b[i] < R.b[i])
696
+ return -1;
697
+ }
698
+ return 0;
699
+ }
700
+
701
+ It has been pointed out that the C99 standard allows for the possibility that
702
+ integer types also may include padding bits, which could invalidate the above
703
+ method. This addition to C99 was specifically included after it was pointed
704
+ out that there was one, presumably not particularly well known, architecture
705
+ that included a padding bit in it's 32 bit integer type. See section 6.2.6.2
706
+ of both the standard and the rationale, specifically the paragraph starting at
707
+ line 16 on page 43 of the rationale.
708
+
709
+
710
+ An aside
711
+
712
+ Certain compilers, e.g. gcc and one of the IBM compilers, include a feature
713
+ extention: provided the union contains a member of the same type as the
714
+ object then the object may be cast to the union itself.
715
+
716
+ We could use this feature to speed up the pthrcmp() function from example 2
717
+ above by casting rather than assigning the pthread_t arguments to the union, e.g.:
718
+
719
+ int pthcmp(pthread_t left, pthread_t right)
720
+ {
721
+ /*
722
+ * Compare two pthread handles in a way that imposes a repeatable but arbitrary
723
+ * ordering on them.
724
+ * I.e. given the same set of pthread_t handles the ordering should be the same
725
+ * each time but the order has no particular meaning other than that. E.g.
726
+ * the ordering does not imply the thread start sequence, or any other
727
+ * relationship between threads.
728
+ *
729
+ * Return values are:
730
+ * 1 : left is greater than right
731
+ * 0 : left is equal to right
732
+ * -1 : left is less than right
733
+ */
734
+ int i;
735
+ for (i = 0; i < sizeof(pthread_t); i++)
736
+ {
737
+ if (((pthcmp_t)left).b[i] > ((pthcmp_t)right).b[i])
738
+ return 1;
739
+ else if (((pthcmp_t)left).b[i] < ((pthcmp_t)right).b[i])
740
+ return -1;
741
+ }
742
+ return 0;
743
+ }
744
+
745
+
746
+ Result thus far
747
+
748
+ We can't remove undefined bits if they are there in pthread_t already, but we have
749
+ attempted to render them inert for comparison and hashing functions by making them
750
+ consistent through assignment, copy and pass-by-value.
751
+
752
+ Note: Hashing pthread_t values requires that all pthread_t variables be initialised
753
+ to the same value (usually all zeros) before being assigned a proper thread ID, i.e.
754
+ to ensure that any padding bits are zero, or at least the same value for all
755
+ pthread_t. Since all pthread_t values are generated by the library in the first
756
+ instance this need not be an application-level operation.
757
+
758
+
759
+ Conclusion
760
+
761
+ I've attempted to resolve the multiple issues of type opacity and the possible
762
+ presence of undefined bits and bytes in pthread_t values, which prevent
763
+ applications from comparing or hashing pthread handles.
764
+
765
+ Two complimentary partial solutions have been proposed, one an application-level
766
+ scheme to handle both scalar and aggregate pthread_t types equally, plus a
767
+ definition of pthread_t itself that neutralises padding bits and bytes by
768
+ coercing semantics out of the compiler to eliminate variations in the values of
769
+ padding bits.
770
+
771
+ I have not provided any solution to the problem of handling extra values embedded
772
+ in pthread_t, e.g. debugging or trap information that an implementation is entitled
773
+ to include. Therefore none of this replaces the portability and flexibility of API
774
+ functions but what functions are needed? The threads standard is unlikely to
775
+ include that can be implemented by a combination of existing features and more
776
+ generic functions (several references in the threads rationale suggest this.
777
+ Therefore I propose that the following function could replace the several functions
778
+ that have been suggested in conversations:
779
+
780
+ pthread_t * pthread_normalize(pthread_t * handle);
781
+
782
+ For most existing pthreads implementations this function, or macro, would reduce to
783
+ a no-op with zero call overhead.