noderb 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +19 -0
- data/README.md +25 -0
- data/ext/noderb_extension/extconf.rb +11 -0
- data/ext/noderb_extension/libuv/AUTHORS +11 -0
- data/ext/noderb_extension/libuv/LICENSE +48 -0
- data/ext/noderb_extension/libuv/Makefile +119 -0
- data/ext/noderb_extension/libuv/README +45 -0
- data/ext/noderb_extension/libuv/build/all.gyp +254 -0
- data/ext/noderb_extension/libuv/build/common.gypi +13 -0
- data/ext/noderb_extension/libuv/build/gyp_uv +43 -0
- data/ext/noderb_extension/libuv/config-mingw.mk +67 -0
- data/ext/noderb_extension/libuv/config-unix.mk +121 -0
- data/ext/noderb_extension/libuv/create-msvs-files.bat +14 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ANNOUNCE +482 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/BUGS +141 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/Bmakefile +268 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/CONTRIBUTORS +140 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING +150 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING.LIB +504 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ChangeLog +5194 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/FAQ +451 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/GNUmakefile +593 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/MAINTAINERS +4 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/Makefile +516 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/NEWS +1245 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile +24 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile.tests +260 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/PROGRESS +4 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/README +601 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.Borland +57 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.CV +3036 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.NONPORTABLE +783 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.Watcom +62 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.WinCE +6 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/TODO +7 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/WinCE-PORT +222 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/attr.c +53 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/autostatic.c +69 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/barrier.c +47 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/build/all.gyp +207 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/builddmc.bat +9 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/cancel.c +44 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/cleanup.c +148 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/condvar.c +50 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/config.h +153 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/context.h +74 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/create.c +308 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/dll.c +92 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/errno.c +94 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/exit.c +44 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/fork.c +39 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/global.c +107 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/implement.h +944 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/misc.c +50 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/mutex.c +62 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/need_errno.h +145 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/nonportable.c +47 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/private.c +54 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.c +66 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsp +142 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsw +29 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.h +1368 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_destroy.c +79 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getdetachstate.c +86 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getinheritsched.c +51 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedparam.c +52 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedpolicy.c +61 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getscope.c +54 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstackaddr.c +97 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstacksize.c +100 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_init.c +117 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setdetachstate.c +91 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setinheritsched.c +57 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedparam.c +63 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedpolicy.c +55 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setscope.c +62 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstackaddr.c +97 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstacksize.c +110 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_destroy.c +103 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_init.c +69 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_wait.c +104 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_destroy.c +83 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_getpshared.c +95 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_init.c +85 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_setpshared.c +119 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cancel.c +189 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_destroy.c +253 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_init.c +167 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_signal.c +231 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_wait.c +567 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_destroy.c +86 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_getpshared.c +97 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_init.c +87 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_setpshared.c +117 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_delay_np.c +172 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_detach.c +136 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_equal.c +76 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_exit.c +106 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getconcurrency.c +45 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getschedparam.c +75 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getspecific.c +87 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getunique_np.c +47 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getw32threadhandle_np.c +65 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_join.c +157 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_create.c +108 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_delete.c +125 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_kill.c +105 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_consistent.c +187 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_destroy.c +148 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_init.c +130 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_lock.c +269 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_timedlock.c +324 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_trylock.c +154 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_unlock.c +175 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_destroy.c +83 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getkind_np.c +44 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getpshared.c +95 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getrobust.c +113 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_gettype.c +56 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_init.c +86 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setkind_np.c +44 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setpshared.c +119 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setrobust.c +119 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_settype.c +143 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_num_processors_np.c +56 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_once.c +79 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_destroy.c +143 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_init.c +109 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_rdlock.c +102 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedrdlock.c +109 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedwrlock.c +139 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_tryrdlock.c +102 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_trywrlock.c +122 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_unlock.c +93 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_wrlock.c +133 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_destroy.c +84 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_getpshared.c +97 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_init.c +83 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_setpshared.c +120 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_self.c +141 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcancelstate.c +125 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcanceltype.c +126 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setconcurrency.c +53 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setschedparam.c +123 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setspecific.c +167 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_destroy.c +111 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_init.c +123 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_lock.c +80 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_trylock.c +77 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_unlock.c +71 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_testcancel.c +103 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_timechange_handler_np.c +108 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_win32_attach_detach_np.c +258 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_MCS_lock.c +278 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_callUserDestroyRoutines.c +232 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_calloc.c +56 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_cond_check_need_init.c +78 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_getprocessors.c +91 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_is_attr.c +47 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_mutex_check_need_init.c +92 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_new.c +94 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processInitialize.c +92 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processTerminate.c +105 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_relmillisecs.c +132 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_reuse.c +151 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_cancelwrwait.c +50 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_check_need_init.c +77 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_semwait.c +135 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_spinlock_check_need_init.c +78 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadDestroy.c +79 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadStart.c +357 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_throw.c +189 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_timespec.c +83 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocCreate.c +118 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocDestroy.c +114 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/rwlock.c +51 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched.c +53 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched.h +183 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_max.c +134 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_min.c +135 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_getscheduler.c +71 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_setscheduler.c +83 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_yield.c +71 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_close.c +58 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_destroy.c +144 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_getvalue.c +110 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_init.c +169 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_open.c +58 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post.c +128 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post_multiple.c +142 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_timedwait.c +238 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_trywait.c +117 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_unlink.c +58 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_wait.c +187 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.c +69 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.h +169 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/signal.c +179 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/spin.c +46 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/sync.c +43 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/tsd.c +44 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/version.rc +388 -0
- data/ext/noderb_extension/libuv/deps/pthread-win32/w32_CancelableWait.c +161 -0
- data/ext/noderb_extension/libuv/doc/desired-api.md +159 -0
- data/ext/noderb_extension/libuv/doc/iocp-links.html +574 -0
- data/ext/noderb_extension/libuv/include/ares.h +582 -0
- data/ext/noderb_extension/libuv/include/ares_version.h +24 -0
- data/ext/noderb_extension/libuv/include/eio.h +376 -0
- data/ext/noderb_extension/libuv/include/ev.h +835 -0
- data/ext/noderb_extension/libuv/include/ngx-queue.h +102 -0
- data/ext/noderb_extension/libuv/include/tree.h +762 -0
- data/ext/noderb_extension/libuv/include/uv-unix.h +138 -0
- data/ext/noderb_extension/libuv/include/uv-win.h +187 -0
- data/ext/noderb_extension/libuv/include/uv.h +635 -0
- data/ext/noderb_extension/libuv/src/ares/AUTHORS +37 -0
- data/ext/noderb_extension/libuv/src/ares/CHANGES +1198 -0
- data/ext/noderb_extension/libuv/src/ares/CMakeLists.txt +22 -0
- data/ext/noderb_extension/libuv/src/ares/NEWS +21 -0
- data/ext/noderb_extension/libuv/src/ares/README +60 -0
- data/ext/noderb_extension/libuv/src/ares/README.cares +13 -0
- data/ext/noderb_extension/libuv/src/ares/README.msvc +118 -0
- data/ext/noderb_extension/libuv/src/ares/README.node +21 -0
- data/ext/noderb_extension/libuv/src/ares/RELEASE-NOTES +25 -0
- data/ext/noderb_extension/libuv/src/ares/TODO +23 -0
- data/ext/noderb_extension/libuv/src/ares/ares__close_sockets.c +66 -0
- data/ext/noderb_extension/libuv/src/ares/ares__get_hostent.c +263 -0
- data/ext/noderb_extension/libuv/src/ares/ares__read_line.c +71 -0
- data/ext/noderb_extension/libuv/src/ares/ares__timeval.c +111 -0
- data/ext/noderb_extension/libuv/src/ares/ares_cancel.c +63 -0
- data/ext/noderb_extension/libuv/src/ares/ares_data.c +190 -0
- data/ext/noderb_extension/libuv/src/ares/ares_data.h +65 -0
- data/ext/noderb_extension/libuv/src/ares/ares_destroy.c +105 -0
- data/ext/noderb_extension/libuv/src/ares/ares_dns.h +90 -0
- data/ext/noderb_extension/libuv/src/ares/ares_expand_name.c +193 -0
- data/ext/noderb_extension/libuv/src/ares/ares_expand_string.c +75 -0
- data/ext/noderb_extension/libuv/src/ares/ares_fds.c +62 -0
- data/ext/noderb_extension/libuv/src/ares/ares_free_hostent.c +39 -0
- data/ext/noderb_extension/libuv/src/ares/ares_free_string.c +25 -0
- data/ext/noderb_extension/libuv/src/ares/ares_gethostbyaddr.c +292 -0
- data/ext/noderb_extension/libuv/src/ares/ares_gethostbyname.c +515 -0
- data/ext/noderb_extension/libuv/src/ares/ares_getnameinfo.c +426 -0
- data/ext/noderb_extension/libuv/src/ares/ares_getopt.c +122 -0
- data/ext/noderb_extension/libuv/src/ares/ares_getopt.h +53 -0
- data/ext/noderb_extension/libuv/src/ares/ares_getsock.c +72 -0
- data/ext/noderb_extension/libuv/src/ares/ares_init.c +1665 -0
- data/ext/noderb_extension/libuv/src/ares/ares_ipv6.h +78 -0
- data/ext/noderb_extension/libuv/src/ares/ares_library_init.c +132 -0
- data/ext/noderb_extension/libuv/src/ares/ares_library_init.h +39 -0
- data/ext/noderb_extension/libuv/src/ares/ares_llist.c +86 -0
- data/ext/noderb_extension/libuv/src/ares/ares_llist.h +42 -0
- data/ext/noderb_extension/libuv/src/ares/ares_mkquery.c +195 -0
- data/ext/noderb_extension/libuv/src/ares/ares_nowarn.c +59 -0
- data/ext/noderb_extension/libuv/src/ares/ares_nowarn.h +24 -0
- data/ext/noderb_extension/libuv/src/ares/ares_options.c +253 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_a_reply.c +260 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_aaaa_reply.c +256 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_mx_reply.c +170 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_ns_reply.c +182 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_ptr_reply.c +208 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_srv_reply.c +179 -0
- data/ext/noderb_extension/libuv/src/ares/ares_parse_txt_reply.c +201 -0
- data/ext/noderb_extension/libuv/src/ares/ares_private.h +351 -0
- data/ext/noderb_extension/libuv/src/ares/ares_process.c +1296 -0
- data/ext/noderb_extension/libuv/src/ares/ares_query.c +183 -0
- data/ext/noderb_extension/libuv/src/ares/ares_rules.h +144 -0
- data/ext/noderb_extension/libuv/src/ares/ares_search.c +322 -0
- data/ext/noderb_extension/libuv/src/ares/ares_send.c +134 -0
- data/ext/noderb_extension/libuv/src/ares/ares_setup.h +191 -0
- data/ext/noderb_extension/libuv/src/ares/ares_strcasecmp.c +66 -0
- data/ext/noderb_extension/libuv/src/ares/ares_strcasecmp.h +30 -0
- data/ext/noderb_extension/libuv/src/ares/ares_strdup.c +42 -0
- data/ext/noderb_extension/libuv/src/ares/ares_strdup.h +26 -0
- data/ext/noderb_extension/libuv/src/ares/ares_strerror.c +56 -0
- data/ext/noderb_extension/libuv/src/ares/ares_timeout.c +80 -0
- data/ext/noderb_extension/libuv/src/ares/ares_version.c +11 -0
- data/ext/noderb_extension/libuv/src/ares/ares_writev.c +79 -0
- data/ext/noderb_extension/libuv/src/ares/ares_writev.h +36 -0
- data/ext/noderb_extension/libuv/src/ares/bitncmp.c +59 -0
- data/ext/noderb_extension/libuv/src/ares/bitncmp.h +26 -0
- data/ext/noderb_extension/libuv/src/ares/config_cygwin/ares_config.h +510 -0
- data/ext/noderb_extension/libuv/src/ares/config_darwin/ares_config.h +510 -0
- data/ext/noderb_extension/libuv/src/ares/config_freebsd/ares_config.h +510 -0
- data/ext/noderb_extension/libuv/src/ares/config_linux/ares_config.h +510 -0
- data/ext/noderb_extension/libuv/src/ares/config_openbsd/ares_config.h +510 -0
- data/ext/noderb_extension/libuv/src/ares/config_sunos/ares_config.h +510 -0
- data/ext/noderb_extension/libuv/src/ares/config_win32/ares_config.h +369 -0
- data/ext/noderb_extension/libuv/src/ares/get_ver.awk +35 -0
- data/ext/noderb_extension/libuv/src/ares/inet_net_pton.c +450 -0
- data/ext/noderb_extension/libuv/src/ares/inet_net_pton.h +31 -0
- data/ext/noderb_extension/libuv/src/ares/inet_ntop.c +232 -0
- data/ext/noderb_extension/libuv/src/ares/inet_ntop.h +27 -0
- data/ext/noderb_extension/libuv/src/ares/nameser.h +193 -0
- data/ext/noderb_extension/libuv/src/ares/setup_once.h +488 -0
- data/ext/noderb_extension/libuv/src/ares/windows_port.c +22 -0
- data/ext/noderb_extension/libuv/src/eio/Changes +63 -0
- data/ext/noderb_extension/libuv/src/eio/LICENSE +36 -0
- data/ext/noderb_extension/libuv/src/eio/Makefile.am +15 -0
- data/ext/noderb_extension/libuv/src/eio/aclocal.m4 +8957 -0
- data/ext/noderb_extension/libuv/src/eio/autogen.sh +3 -0
- data/ext/noderb_extension/libuv/src/eio/config.h.in +86 -0
- data/ext/noderb_extension/libuv/src/eio/config_cygwin.h +77 -0
- data/ext/noderb_extension/libuv/src/eio/config_darwin.h +137 -0
- data/ext/noderb_extension/libuv/src/eio/config_freebsd.h +78 -0
- data/ext/noderb_extension/libuv/src/eio/config_linux.h +101 -0
- data/ext/noderb_extension/libuv/src/eio/config_sunos.h +81 -0
- data/ext/noderb_extension/libuv/src/eio/configure.ac +22 -0
- data/ext/noderb_extension/libuv/src/eio/demo.c +194 -0
- data/ext/noderb_extension/libuv/src/eio/ecb.h +370 -0
- data/ext/noderb_extension/libuv/src/eio/eio.3 +3428 -0
- data/ext/noderb_extension/libuv/src/eio/eio.c +2562 -0
- data/ext/noderb_extension/libuv/src/eio/eio.pod +969 -0
- data/ext/noderb_extension/libuv/src/eio/libeio.m4 +195 -0
- data/ext/noderb_extension/libuv/src/eio/xthread.h +164 -0
- data/ext/noderb_extension/libuv/src/ev/Changes +388 -0
- data/ext/noderb_extension/libuv/src/ev/LICENSE +36 -0
- data/ext/noderb_extension/libuv/src/ev/Makefile.am +18 -0
- data/ext/noderb_extension/libuv/src/ev/Makefile.in +771 -0
- data/ext/noderb_extension/libuv/src/ev/README +58 -0
- data/ext/noderb_extension/libuv/src/ev/aclocal.m4 +8957 -0
- data/ext/noderb_extension/libuv/src/ev/autogen.sh +6 -0
- data/ext/noderb_extension/libuv/src/ev/config.guess +1526 -0
- data/ext/noderb_extension/libuv/src/ev/config.h.in +125 -0
- data/ext/noderb_extension/libuv/src/ev/config.sub +1658 -0
- data/ext/noderb_extension/libuv/src/ev/config_cygwin.h +123 -0
- data/ext/noderb_extension/libuv/src/ev/config_darwin.h +122 -0
- data/ext/noderb_extension/libuv/src/ev/config_freebsd.h +120 -0
- data/ext/noderb_extension/libuv/src/ev/config_linux.h +130 -0
- data/ext/noderb_extension/libuv/src/ev/config_sunos.h +122 -0
- data/ext/noderb_extension/libuv/src/ev/configure +13037 -0
- data/ext/noderb_extension/libuv/src/ev/configure.ac +18 -0
- data/ext/noderb_extension/libuv/src/ev/depcomp +630 -0
- data/ext/noderb_extension/libuv/src/ev/ev++.h +816 -0
- data/ext/noderb_extension/libuv/src/ev/ev.3 +5311 -0
- data/ext/noderb_extension/libuv/src/ev/ev.c +3913 -0
- data/ext/noderb_extension/libuv/src/ev/ev.pod +5243 -0
- data/ext/noderb_extension/libuv/src/ev/ev_epoll.c +266 -0
- data/ext/noderb_extension/libuv/src/ev/ev_kqueue.c +198 -0
- data/ext/noderb_extension/libuv/src/ev/ev_poll.c +148 -0
- data/ext/noderb_extension/libuv/src/ev/ev_port.c +179 -0
- data/ext/noderb_extension/libuv/src/ev/ev_select.c +310 -0
- data/ext/noderb_extension/libuv/src/ev/ev_vars.h +203 -0
- data/ext/noderb_extension/libuv/src/ev/ev_win32.c +153 -0
- data/ext/noderb_extension/libuv/src/ev/ev_wrap.h +196 -0
- data/ext/noderb_extension/libuv/src/ev/event.c +402 -0
- data/ext/noderb_extension/libuv/src/ev/event.h +170 -0
- data/ext/noderb_extension/libuv/src/ev/install-sh +294 -0
- data/ext/noderb_extension/libuv/src/ev/libev.m4 +39 -0
- data/ext/noderb_extension/libuv/src/ev/ltmain.sh +8413 -0
- data/ext/noderb_extension/libuv/src/ev/missing +336 -0
- data/ext/noderb_extension/libuv/src/ev/mkinstalldirs +111 -0
- data/ext/noderb_extension/libuv/src/uv-common.c +172 -0
- data/ext/noderb_extension/libuv/src/uv-common.h +53 -0
- data/ext/noderb_extension/libuv/src/uv-cygwin.c +52 -0
- data/ext/noderb_extension/libuv/src/uv-darwin.c +64 -0
- data/ext/noderb_extension/libuv/src/uv-eio.c +113 -0
- data/ext/noderb_extension/libuv/src/uv-eio.h +13 -0
- data/ext/noderb_extension/libuv/src/uv-freebsd.c +65 -0
- data/ext/noderb_extension/libuv/src/uv-linux.c +51 -0
- data/ext/noderb_extension/libuv/src/uv-sunos.c +60 -0
- data/ext/noderb_extension/libuv/src/uv-unix.c +2408 -0
- data/ext/noderb_extension/libuv/src/win/async.c +129 -0
- data/ext/noderb_extension/libuv/src/win/cares.c +304 -0
- data/ext/noderb_extension/libuv/src/win/core.c +155 -0
- data/ext/noderb_extension/libuv/src/win/error.c +140 -0
- data/ext/noderb_extension/libuv/src/win/getaddrinfo.c +341 -0
- data/ext/noderb_extension/libuv/src/win/handle.c +176 -0
- data/ext/noderb_extension/libuv/src/win/internal.h +237 -0
- data/ext/noderb_extension/libuv/src/win/loop-watcher.c +128 -0
- data/ext/noderb_extension/libuv/src/win/pipe.c +828 -0
- data/ext/noderb_extension/libuv/src/win/process.c +936 -0
- data/ext/noderb_extension/libuv/src/win/req.c +141 -0
- data/ext/noderb_extension/libuv/src/win/stdio.c +75 -0
- data/ext/noderb_extension/libuv/src/win/stream.c +149 -0
- data/ext/noderb_extension/libuv/src/win/tcp.c +895 -0
- data/ext/noderb_extension/libuv/src/win/timer.c +269 -0
- data/ext/noderb_extension/libuv/src/win/util.c +82 -0
- data/ext/noderb_extension/libuv/test/benchmark-ares.c +117 -0
- data/ext/noderb_extension/libuv/test/benchmark-getaddrinfo.c +90 -0
- data/ext/noderb_extension/libuv/test/benchmark-list.h +77 -0
- data/ext/noderb_extension/libuv/test/benchmark-ping-pongs.c +210 -0
- data/ext/noderb_extension/libuv/test/benchmark-pound.c +237 -0
- data/ext/noderb_extension/libuv/test/benchmark-pump.c +459 -0
- data/ext/noderb_extension/libuv/test/benchmark-sizes.c +39 -0
- data/ext/noderb_extension/libuv/test/benchmark-spawn.c +154 -0
- data/ext/noderb_extension/libuv/test/dns-server.c +323 -0
- data/ext/noderb_extension/libuv/test/echo-server.c +299 -0
- data/ext/noderb_extension/libuv/test/run-benchmarks.c +64 -0
- data/ext/noderb_extension/libuv/test/run-tests.c +82 -0
- data/ext/noderb_extension/libuv/test/runner-unix.c +335 -0
- data/ext/noderb_extension/libuv/test/runner-unix.h +36 -0
- data/ext/noderb_extension/libuv/test/runner-win.c +343 -0
- data/ext/noderb_extension/libuv/test/runner-win.h +42 -0
- data/ext/noderb_extension/libuv/test/runner.c +311 -0
- data/ext/noderb_extension/libuv/test/runner.h +155 -0
- data/ext/noderb_extension/libuv/test/task.h +111 -0
- data/ext/noderb_extension/libuv/test/test-async.c +218 -0
- data/ext/noderb_extension/libuv/test/test-callback-stack.c +205 -0
- data/ext/noderb_extension/libuv/test/test-connection-fail.c +149 -0
- data/ext/noderb_extension/libuv/test/test-delayed-accept.c +198 -0
- data/ext/noderb_extension/libuv/test/test-fail-always.c +29 -0
- data/ext/noderb_extension/libuv/test/test-get-currentexe.c +53 -0
- data/ext/noderb_extension/libuv/test/test-getaddrinfo.c +110 -0
- data/ext/noderb_extension/libuv/test/test-gethostbyname.c +192 -0
- data/ext/noderb_extension/libuv/test/test-getsockname.c +196 -0
- data/ext/noderb_extension/libuv/test/test-hrtime.c +51 -0
- data/ext/noderb_extension/libuv/test/test-idle.c +83 -0
- data/ext/noderb_extension/libuv/test/test-list.h +165 -0
- data/ext/noderb_extension/libuv/test/test-loop-handles.c +361 -0
- data/ext/noderb_extension/libuv/test/test-pass-always.c +28 -0
- data/ext/noderb_extension/libuv/test/test-ping-pong.c +256 -0
- data/ext/noderb_extension/libuv/test/test-pipe-bind-error.c +148 -0
- data/ext/noderb_extension/libuv/test/test-ref.c +91 -0
- data/ext/noderb_extension/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/noderb_extension/libuv/test/test-spawn.c +345 -0
- data/ext/noderb_extension/libuv/test/test-tcp-bind-error.c +204 -0
- data/ext/noderb_extension/libuv/test/test-tcp-bind6-error.c +164 -0
- data/ext/noderb_extension/libuv/test/test-tcp-writealot.c +198 -0
- data/ext/noderb_extension/libuv/test/test-timer-again.c +141 -0
- data/ext/noderb_extension/libuv/test/test-timer.c +134 -0
- data/ext/noderb_extension/noderb.c +340 -0
- data/ext/noderb_extension/noderb.h +2 -0
- data/lib/noderb/connection.rb +21 -0
- data/lib/noderb/process.rb +17 -0
- data/lib/noderb.rb +25 -0
- metadata +470 -0
|
@@ -0,0 +1,944 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* implement.h
|
|
3
|
+
*
|
|
4
|
+
* Definitions that don't need to be public.
|
|
5
|
+
*
|
|
6
|
+
* Keeps all the internals out of pthread.h
|
|
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: Ross.Johnson@homemail.com.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
|
+
#if !defined(_IMPLEMENT_H)
|
|
39
|
+
#define _IMPLEMENT_H
|
|
40
|
+
|
|
41
|
+
#if !defined(_WIN32_WINNT)
|
|
42
|
+
#define _WIN32_WINNT 0x0400
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#include <windows.h>
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
* In case windows.h doesn't define it (e.g. WinCE perhaps)
|
|
49
|
+
*/
|
|
50
|
+
#if defined(WINCE)
|
|
51
|
+
typedef VOID (APIENTRY *PAPCFUNC)(DWORD dwParam);
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* note: ETIMEDOUT is correctly defined in winsock.h
|
|
56
|
+
*/
|
|
57
|
+
#include <winsock.h>
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* In case ETIMEDOUT hasn't been defined above somehow.
|
|
61
|
+
*/
|
|
62
|
+
#if !defined(ETIMEDOUT)
|
|
63
|
+
# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#if !defined(malloc)
|
|
67
|
+
#include <malloc.h>
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#if defined(__CLEANUP_C)
|
|
71
|
+
# include <setjmp.h>
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#if !defined(INT_MAX)
|
|
75
|
+
#include <limits.h>
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
/* use local include files during development */
|
|
79
|
+
#include "semaphore.h"
|
|
80
|
+
#include "sched.h"
|
|
81
|
+
|
|
82
|
+
#if defined(HAVE_C_INLINE) || defined(__cplusplus)
|
|
83
|
+
#define INLINE inline
|
|
84
|
+
#else
|
|
85
|
+
#define INLINE
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#if defined(_MSC_VER) && _MSC_VER < 1300
|
|
89
|
+
/*
|
|
90
|
+
* MSVC 6 does not use the "volatile" qualifier
|
|
91
|
+
*/
|
|
92
|
+
#define PTW32_INTERLOCKED_VOLATILE
|
|
93
|
+
#else
|
|
94
|
+
#define PTW32_INTERLOCKED_VOLATILE volatile
|
|
95
|
+
#endif
|
|
96
|
+
#define PTW32_INTERLOCKED_LONG long
|
|
97
|
+
#define PTW32_INTERLOCKED_SIZE size_t
|
|
98
|
+
#define PTW32_INTERLOCKED_PVOID PVOID
|
|
99
|
+
#define PTW32_INTERLOCKED_LONGPTR PTW32_INTERLOCKED_VOLATILE long*
|
|
100
|
+
#define PTW32_INTERLOCKED_SIZEPTR PTW32_INTERLOCKED_VOLATILE size_t*
|
|
101
|
+
#define PTW32_INTERLOCKED_PVOID_PTR PTW32_INTERLOCKED_VOLATILE PVOID*
|
|
102
|
+
|
|
103
|
+
#if defined(__MINGW64__) || defined(__MINGW32__)
|
|
104
|
+
# include <stdint.h>
|
|
105
|
+
#elif defined(__BORLANDC__)
|
|
106
|
+
# define int64_t ULONGLONG
|
|
107
|
+
#else
|
|
108
|
+
# define int64_t _int64
|
|
109
|
+
# if defined(_MSC_VER) && _MSC_VER < 1300
|
|
110
|
+
typedef long intptr_t;
|
|
111
|
+
# endif
|
|
112
|
+
#endif
|
|
113
|
+
|
|
114
|
+
typedef enum
|
|
115
|
+
{
|
|
116
|
+
/*
|
|
117
|
+
* This enumeration represents the state of the thread;
|
|
118
|
+
* The thread is still "alive" if the numeric value of the
|
|
119
|
+
* state is greater or equal "PThreadStateRunning".
|
|
120
|
+
*/
|
|
121
|
+
PThreadStateInitial = 0, /* Thread not running */
|
|
122
|
+
PThreadStateRunning, /* Thread alive & kicking */
|
|
123
|
+
PThreadStateSuspended, /* Thread alive but suspended */
|
|
124
|
+
PThreadStateCancelPending, /* Thread alive but */
|
|
125
|
+
/* has cancelation pending. */
|
|
126
|
+
PThreadStateCanceling, /* Thread alive but is */
|
|
127
|
+
/* in the process of terminating */
|
|
128
|
+
/* due to a cancellation request */
|
|
129
|
+
PThreadStateExiting, /* Thread alive but exiting */
|
|
130
|
+
/* due to an exception */
|
|
131
|
+
PThreadStateLast, /* All handlers have been run and now */
|
|
132
|
+
/* final cleanup can be done. */
|
|
133
|
+
PThreadStateReuse /* In reuse pool. */
|
|
134
|
+
}
|
|
135
|
+
PThreadState;
|
|
136
|
+
|
|
137
|
+
typedef struct ptw32_mcs_node_t_ ptw32_mcs_local_node_t;
|
|
138
|
+
typedef struct ptw32_mcs_node_t_* ptw32_mcs_lock_t;
|
|
139
|
+
typedef struct ptw32_robust_node_t_ ptw32_robust_node_t;
|
|
140
|
+
typedef struct ptw32_thread_t_ ptw32_thread_t;
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
struct ptw32_thread_t_
|
|
144
|
+
{
|
|
145
|
+
unsigned __int64 seqNumber; /* Process-unique thread sequence number */
|
|
146
|
+
HANDLE threadH; /* Win32 thread handle - POSIX thread is invalid if threadH == 0 */
|
|
147
|
+
pthread_t ptHandle; /* This thread's permanent pthread_t handle */
|
|
148
|
+
ptw32_thread_t * prevReuse; /* Links threads on reuse stack */
|
|
149
|
+
volatile PThreadState state;
|
|
150
|
+
ptw32_mcs_lock_t threadLock; /* Used for serialised access to public thread state */
|
|
151
|
+
ptw32_mcs_lock_t stateLock; /* Used for async-cancel safety */
|
|
152
|
+
HANDLE cancelEvent;
|
|
153
|
+
void *exitStatus;
|
|
154
|
+
void *parms;
|
|
155
|
+
void *keys;
|
|
156
|
+
void *nextAssoc;
|
|
157
|
+
#if defined(__CLEANUP_C)
|
|
158
|
+
jmp_buf start_mark; /* Jump buffer follows void* so should be aligned */
|
|
159
|
+
#endif /* __CLEANUP_C */
|
|
160
|
+
#if defined(HAVE_SIGSET_T)
|
|
161
|
+
sigset_t sigmask;
|
|
162
|
+
#endif /* HAVE_SIGSET_T */
|
|
163
|
+
ptw32_mcs_lock_t
|
|
164
|
+
robustMxListLock; /* robustMxList lock */
|
|
165
|
+
ptw32_robust_node_t*
|
|
166
|
+
robustMxList; /* List of currenty held robust mutexes */
|
|
167
|
+
int ptErrno;
|
|
168
|
+
int detachState;
|
|
169
|
+
int sched_priority; /* As set, not as currently is */
|
|
170
|
+
int cancelState;
|
|
171
|
+
int cancelType;
|
|
172
|
+
int implicit:1;
|
|
173
|
+
DWORD thread; /* Win32 thread ID */
|
|
174
|
+
#if defined(_UWIN)
|
|
175
|
+
DWORD dummy[5];
|
|
176
|
+
#endif
|
|
177
|
+
size_t align; /* Force alignment if this struct is packed */
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
/*
|
|
182
|
+
* Special value to mark attribute objects as valid.
|
|
183
|
+
*/
|
|
184
|
+
#define PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
|
|
185
|
+
|
|
186
|
+
struct pthread_attr_t_
|
|
187
|
+
{
|
|
188
|
+
unsigned long valid;
|
|
189
|
+
void *stackaddr;
|
|
190
|
+
size_t stacksize;
|
|
191
|
+
int detachstate;
|
|
192
|
+
struct sched_param param;
|
|
193
|
+
int inheritsched;
|
|
194
|
+
int contentionscope;
|
|
195
|
+
#if defined(HAVE_SIGSET_T)
|
|
196
|
+
sigset_t sigmask;
|
|
197
|
+
#endif /* HAVE_SIGSET_T */
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
/*
|
|
202
|
+
* ====================
|
|
203
|
+
* ====================
|
|
204
|
+
* Semaphores, Mutexes and Condition Variables
|
|
205
|
+
* ====================
|
|
206
|
+
* ====================
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
struct sem_t_
|
|
210
|
+
{
|
|
211
|
+
int value;
|
|
212
|
+
pthread_mutex_t lock;
|
|
213
|
+
HANDLE sem;
|
|
214
|
+
#if defined(NEED_SEM)
|
|
215
|
+
int leftToUnblock;
|
|
216
|
+
#endif
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
#define PTW32_OBJECT_AUTO_INIT ((void *)(size_t) -1)
|
|
220
|
+
#define PTW32_OBJECT_INVALID NULL
|
|
221
|
+
|
|
222
|
+
struct pthread_mutex_t_
|
|
223
|
+
{
|
|
224
|
+
LONG lock_idx; /* Provides exclusive access to mutex state
|
|
225
|
+
via the Interlocked* mechanism.
|
|
226
|
+
0: unlocked/free.
|
|
227
|
+
1: locked - no other waiters.
|
|
228
|
+
-1: locked - with possible other waiters.
|
|
229
|
+
*/
|
|
230
|
+
int recursive_count; /* Number of unlocks a thread needs to perform
|
|
231
|
+
before the lock is released (recursive
|
|
232
|
+
mutexes only). */
|
|
233
|
+
int kind; /* Mutex type. */
|
|
234
|
+
pthread_t ownerThread;
|
|
235
|
+
HANDLE event; /* Mutex release notification to waiting
|
|
236
|
+
threads. */
|
|
237
|
+
ptw32_robust_node_t*
|
|
238
|
+
robustNode; /* Extra state for robust mutexes */
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
enum ptw32_robust_state_t_
|
|
242
|
+
{
|
|
243
|
+
PTW32_ROBUST_CONSISTENT,
|
|
244
|
+
PTW32_ROBUST_INCONSISTENT,
|
|
245
|
+
PTW32_ROBUST_NOTRECOVERABLE
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
typedef enum ptw32_robust_state_t_ ptw32_robust_state_t;
|
|
249
|
+
|
|
250
|
+
/*
|
|
251
|
+
* Node used to manage per-thread lists of currently-held robust mutexes.
|
|
252
|
+
*/
|
|
253
|
+
struct ptw32_robust_node_t_
|
|
254
|
+
{
|
|
255
|
+
pthread_mutex_t mx;
|
|
256
|
+
ptw32_robust_state_t stateInconsistent;
|
|
257
|
+
ptw32_robust_node_t* prev;
|
|
258
|
+
ptw32_robust_node_t* next;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
struct pthread_mutexattr_t_
|
|
262
|
+
{
|
|
263
|
+
int pshared;
|
|
264
|
+
int kind;
|
|
265
|
+
int robustness;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
/*
|
|
269
|
+
* Possible values, other than PTW32_OBJECT_INVALID,
|
|
270
|
+
* for the "interlock" element in a spinlock.
|
|
271
|
+
*
|
|
272
|
+
* In this implementation, when a spinlock is initialised,
|
|
273
|
+
* the number of cpus available to the process is checked.
|
|
274
|
+
* If there is only one cpu then "interlock" is set equal to
|
|
275
|
+
* PTW32_SPIN_USE_MUTEX and u.mutex is an initialised mutex.
|
|
276
|
+
* If the number of cpus is greater than 1 then "interlock"
|
|
277
|
+
* is set equal to PTW32_SPIN_UNLOCKED and the number is
|
|
278
|
+
* stored in u.cpus. This arrangement allows the spinlock
|
|
279
|
+
* routines to attempt an InterlockedCompareExchange on "interlock"
|
|
280
|
+
* immediately and, if that fails, to try the inferior mutex.
|
|
281
|
+
*
|
|
282
|
+
* "u.cpus" isn't used for anything yet, but could be used at
|
|
283
|
+
* some point to optimise spinlock behaviour.
|
|
284
|
+
*/
|
|
285
|
+
#define PTW32_SPIN_INVALID (0)
|
|
286
|
+
#define PTW32_SPIN_UNLOCKED (1)
|
|
287
|
+
#define PTW32_SPIN_LOCKED (2)
|
|
288
|
+
#define PTW32_SPIN_USE_MUTEX (3)
|
|
289
|
+
|
|
290
|
+
struct pthread_spinlock_t_
|
|
291
|
+
{
|
|
292
|
+
long interlock; /* Locking element for multi-cpus. */
|
|
293
|
+
union
|
|
294
|
+
{
|
|
295
|
+
int cpus; /* No. of cpus if multi cpus, or */
|
|
296
|
+
pthread_mutex_t mutex; /* mutex if single cpu. */
|
|
297
|
+
} u;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
/*
|
|
301
|
+
* MCS lock queue node - see ptw32_MCS_lock.c
|
|
302
|
+
*/
|
|
303
|
+
struct ptw32_mcs_node_t_
|
|
304
|
+
{
|
|
305
|
+
struct ptw32_mcs_node_t_ **lock; /* ptr to tail of queue */
|
|
306
|
+
struct ptw32_mcs_node_t_ *next; /* ptr to successor in queue */
|
|
307
|
+
HANDLE readyFlag; /* set after lock is released by
|
|
308
|
+
predecessor */
|
|
309
|
+
HANDLE nextFlag; /* set after 'next' ptr is set by
|
|
310
|
+
successor */
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
struct pthread_barrier_t_
|
|
315
|
+
{
|
|
316
|
+
unsigned int nCurrentBarrierHeight;
|
|
317
|
+
unsigned int nInitialBarrierHeight;
|
|
318
|
+
int pshared;
|
|
319
|
+
sem_t semBarrierBreeched;
|
|
320
|
+
ptw32_mcs_lock_t lock;
|
|
321
|
+
ptw32_mcs_local_node_t proxynode;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
struct pthread_barrierattr_t_
|
|
325
|
+
{
|
|
326
|
+
int pshared;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
struct pthread_key_t_
|
|
330
|
+
{
|
|
331
|
+
DWORD key;
|
|
332
|
+
void (*destructor) (void *);
|
|
333
|
+
ptw32_mcs_lock_t keyLock;
|
|
334
|
+
void *threads;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
typedef struct ThreadParms ThreadParms;
|
|
339
|
+
|
|
340
|
+
struct ThreadParms
|
|
341
|
+
{
|
|
342
|
+
pthread_t tid;
|
|
343
|
+
void *(*start) (void *);
|
|
344
|
+
void *arg;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
struct pthread_cond_t_
|
|
349
|
+
{
|
|
350
|
+
long nWaitersBlocked; /* Number of threads blocked */
|
|
351
|
+
long nWaitersGone; /* Number of threads timed out */
|
|
352
|
+
long nWaitersToUnblock; /* Number of threads to unblock */
|
|
353
|
+
sem_t semBlockQueue; /* Queue up threads waiting for the */
|
|
354
|
+
/* condition to become signalled */
|
|
355
|
+
sem_t semBlockLock; /* Semaphore that guards access to */
|
|
356
|
+
/* | waiters blocked count/block queue */
|
|
357
|
+
/* +-> Mandatory Sync.LEVEL-1 */
|
|
358
|
+
pthread_mutex_t mtxUnblockLock; /* Mutex that guards access to */
|
|
359
|
+
/* | waiters (to)unblock(ed) counts */
|
|
360
|
+
/* +-> Optional* Sync.LEVEL-2 */
|
|
361
|
+
pthread_cond_t next; /* Doubly linked list */
|
|
362
|
+
pthread_cond_t prev;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
struct pthread_condattr_t_
|
|
367
|
+
{
|
|
368
|
+
int pshared;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
#define PTW32_RWLOCK_MAGIC 0xfacade2
|
|
372
|
+
|
|
373
|
+
struct pthread_rwlock_t_
|
|
374
|
+
{
|
|
375
|
+
pthread_mutex_t mtxExclusiveAccess;
|
|
376
|
+
pthread_mutex_t mtxSharedAccessCompleted;
|
|
377
|
+
pthread_cond_t cndSharedAccessCompleted;
|
|
378
|
+
int nSharedAccessCount;
|
|
379
|
+
int nExclusiveAccessCount;
|
|
380
|
+
int nCompletedSharedAccessCount;
|
|
381
|
+
int nMagic;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
struct pthread_rwlockattr_t_
|
|
385
|
+
{
|
|
386
|
+
int pshared;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
typedef struct ThreadKeyAssoc ThreadKeyAssoc;
|
|
390
|
+
|
|
391
|
+
struct ThreadKeyAssoc
|
|
392
|
+
{
|
|
393
|
+
/*
|
|
394
|
+
* Purpose:
|
|
395
|
+
* This structure creates an association between a thread and a key.
|
|
396
|
+
* It is used to implement the implicit invocation of a user defined
|
|
397
|
+
* destroy routine for thread specific data registered by a user upon
|
|
398
|
+
* exiting a thread.
|
|
399
|
+
*
|
|
400
|
+
* Graphically, the arrangement is as follows, where:
|
|
401
|
+
*
|
|
402
|
+
* K - Key with destructor
|
|
403
|
+
* (head of chain is key->threads)
|
|
404
|
+
* T - Thread that has called pthread_setspecific(Kn)
|
|
405
|
+
* (head of chain is thread->keys)
|
|
406
|
+
* A - Association. Each association is a node at the
|
|
407
|
+
* intersection of two doubly-linked lists.
|
|
408
|
+
*
|
|
409
|
+
* T1 T2 T3
|
|
410
|
+
* | | |
|
|
411
|
+
* | | |
|
|
412
|
+
* K1 -----+-----A-----A----->
|
|
413
|
+
* | | |
|
|
414
|
+
* | | |
|
|
415
|
+
* K2 -----A-----A-----+----->
|
|
416
|
+
* | | |
|
|
417
|
+
* | | |
|
|
418
|
+
* K3 -----A-----+-----A----->
|
|
419
|
+
* | | |
|
|
420
|
+
* | | |
|
|
421
|
+
* V V V
|
|
422
|
+
*
|
|
423
|
+
* Access to the association is guarded by two locks: the key's
|
|
424
|
+
* general lock (guarding the row) and the thread's general
|
|
425
|
+
* lock (guarding the column). This avoids the need for a
|
|
426
|
+
* dedicated lock for each association, which not only consumes
|
|
427
|
+
* more handles but requires that the lock resources persist
|
|
428
|
+
* until both the key is deleted and the thread has called the
|
|
429
|
+
* destructor. The two-lock arrangement allows those resources
|
|
430
|
+
* to be freed as soon as either thread or key is concluded.
|
|
431
|
+
*
|
|
432
|
+
* To avoid deadlock, whenever both locks are required both the
|
|
433
|
+
* key and thread locks are acquired consistently in the order
|
|
434
|
+
* "key lock then thread lock". An exception to this exists
|
|
435
|
+
* when a thread calls the destructors, however, this is done
|
|
436
|
+
* carefully (but inelegantly) to avoid deadlock.
|
|
437
|
+
*
|
|
438
|
+
* An association is created when a thread first calls
|
|
439
|
+
* pthread_setspecific() on a key that has a specified
|
|
440
|
+
* destructor.
|
|
441
|
+
*
|
|
442
|
+
* An association is destroyed either immediately after the
|
|
443
|
+
* thread calls the key destructor function on thread exit, or
|
|
444
|
+
* when the key is deleted.
|
|
445
|
+
*
|
|
446
|
+
* Attributes:
|
|
447
|
+
* thread
|
|
448
|
+
* reference to the thread that owns the
|
|
449
|
+
* association. This is actually the pointer to the
|
|
450
|
+
* thread struct itself. Since the association is
|
|
451
|
+
* destroyed before the thread exits, this can never
|
|
452
|
+
* point to a different logical thread to the one that
|
|
453
|
+
* created the assoc, i.e. after thread struct reuse.
|
|
454
|
+
*
|
|
455
|
+
* key
|
|
456
|
+
* reference to the key that owns the association.
|
|
457
|
+
*
|
|
458
|
+
* nextKey
|
|
459
|
+
* The pthread_t->keys attribute is the head of a
|
|
460
|
+
* chain of associations that runs through the nextKey
|
|
461
|
+
* link. This chain provides the 1 to many relationship
|
|
462
|
+
* between a pthread_t and all pthread_key_t on which
|
|
463
|
+
* it called pthread_setspecific.
|
|
464
|
+
*
|
|
465
|
+
* prevKey
|
|
466
|
+
* Similarly.
|
|
467
|
+
*
|
|
468
|
+
* nextThread
|
|
469
|
+
* The pthread_key_t->threads attribute is the head of
|
|
470
|
+
* a chain of associations that runs through the
|
|
471
|
+
* nextThreads link. This chain provides the 1 to many
|
|
472
|
+
* relationship between a pthread_key_t and all the
|
|
473
|
+
* PThreads that have called pthread_setspecific for
|
|
474
|
+
* this pthread_key_t.
|
|
475
|
+
*
|
|
476
|
+
* prevThread
|
|
477
|
+
* Similarly.
|
|
478
|
+
*
|
|
479
|
+
* Notes:
|
|
480
|
+
* 1) As soon as either the key or the thread is no longer
|
|
481
|
+
* referencing the association, it can be destroyed. The
|
|
482
|
+
* association will be removed from both chains.
|
|
483
|
+
*
|
|
484
|
+
* 2) Under WIN32, an association is only created by
|
|
485
|
+
* pthread_setspecific if the user provided a
|
|
486
|
+
* destroyRoutine when they created the key.
|
|
487
|
+
*
|
|
488
|
+
*
|
|
489
|
+
*/
|
|
490
|
+
ptw32_thread_t * thread;
|
|
491
|
+
pthread_key_t key;
|
|
492
|
+
ThreadKeyAssoc *nextKey;
|
|
493
|
+
ThreadKeyAssoc *nextThread;
|
|
494
|
+
ThreadKeyAssoc *prevKey;
|
|
495
|
+
ThreadKeyAssoc *prevThread;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
#if defined(__CLEANUP_SEH)
|
|
500
|
+
/*
|
|
501
|
+
* --------------------------------------------------------------
|
|
502
|
+
* MAKE_SOFTWARE_EXCEPTION
|
|
503
|
+
* This macro constructs a software exception code following
|
|
504
|
+
* the same format as the standard Win32 error codes as defined
|
|
505
|
+
* in WINERROR.H
|
|
506
|
+
* Values are 32 bit values laid out as follows:
|
|
507
|
+
*
|
|
508
|
+
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|
509
|
+
* +---+-+-+-----------------------+-------------------------------+
|
|
510
|
+
* |Sev|C|R| Facility | Code |
|
|
511
|
+
* +---+-+-+-----------------------+-------------------------------+
|
|
512
|
+
*
|
|
513
|
+
* Severity Values:
|
|
514
|
+
*/
|
|
515
|
+
#define SE_SUCCESS 0x00
|
|
516
|
+
#define SE_INFORMATION 0x01
|
|
517
|
+
#define SE_WARNING 0x02
|
|
518
|
+
#define SE_ERROR 0x03
|
|
519
|
+
|
|
520
|
+
#define MAKE_SOFTWARE_EXCEPTION( _severity, _facility, _exception ) \
|
|
521
|
+
( (DWORD) ( ( (_severity) << 30 ) | /* Severity code */ \
|
|
522
|
+
( 1 << 29 ) | /* MS=0, User=1 */ \
|
|
523
|
+
( 0 << 28 ) | /* Reserved */ \
|
|
524
|
+
( (_facility) << 16 ) | /* Facility Code */ \
|
|
525
|
+
( (_exception) << 0 ) /* Exception Code */ \
|
|
526
|
+
) )
|
|
527
|
+
|
|
528
|
+
/*
|
|
529
|
+
* We choose one specific Facility/Error code combination to
|
|
530
|
+
* identify our software exceptions vs. WIN32 exceptions.
|
|
531
|
+
* We store our actual component and error code within
|
|
532
|
+
* the optional information array.
|
|
533
|
+
*/
|
|
534
|
+
#define EXCEPTION_PTW32_SERVICES \
|
|
535
|
+
MAKE_SOFTWARE_EXCEPTION( SE_ERROR, \
|
|
536
|
+
PTW32_SERVICES_FACILITY, \
|
|
537
|
+
PTW32_SERVICES_ERROR )
|
|
538
|
+
|
|
539
|
+
#define PTW32_SERVICES_FACILITY 0xBAD
|
|
540
|
+
#define PTW32_SERVICES_ERROR 0xDEED
|
|
541
|
+
|
|
542
|
+
#endif /* __CLEANUP_SEH */
|
|
543
|
+
|
|
544
|
+
/*
|
|
545
|
+
* Services available through EXCEPTION_PTW32_SERVICES
|
|
546
|
+
* and also used [as parameters to ptw32_throw()] as
|
|
547
|
+
* generic exception selectors.
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
#define PTW32_EPS_EXIT (1)
|
|
551
|
+
#define PTW32_EPS_CANCEL (2)
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
/* Useful macros */
|
|
555
|
+
#define PTW32_MAX(a,b) ((a)<(b)?(b):(a))
|
|
556
|
+
#define PTW32_MIN(a,b) ((a)>(b)?(b):(a))
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
/* Declared in pthread_cancel.c */
|
|
560
|
+
extern DWORD (*ptw32_register_cancelation) (PAPCFUNC, HANDLE, DWORD);
|
|
561
|
+
|
|
562
|
+
/* Thread Reuse stack bottom marker. Must not be NULL or any valid pointer to memory. */
|
|
563
|
+
#define PTW32_THREAD_REUSE_EMPTY ((ptw32_thread_t *)(size_t) 1)
|
|
564
|
+
|
|
565
|
+
extern int ptw32_processInitialized;
|
|
566
|
+
extern ptw32_thread_t * ptw32_threadReuseTop;
|
|
567
|
+
extern ptw32_thread_t * ptw32_threadReuseBottom;
|
|
568
|
+
extern pthread_key_t ptw32_selfThreadKey;
|
|
569
|
+
extern pthread_key_t ptw32_cleanupKey;
|
|
570
|
+
extern pthread_cond_t ptw32_cond_list_head;
|
|
571
|
+
extern pthread_cond_t ptw32_cond_list_tail;
|
|
572
|
+
|
|
573
|
+
extern int ptw32_mutex_default_kind;
|
|
574
|
+
|
|
575
|
+
extern unsigned __int64 ptw32_threadSeqNumber;
|
|
576
|
+
|
|
577
|
+
extern int ptw32_concurrency;
|
|
578
|
+
|
|
579
|
+
extern int ptw32_features;
|
|
580
|
+
|
|
581
|
+
extern ptw32_mcs_lock_t ptw32_thread_reuse_lock;
|
|
582
|
+
extern ptw32_mcs_lock_t ptw32_mutex_test_init_lock;
|
|
583
|
+
extern ptw32_mcs_lock_t ptw32_cond_list_lock;
|
|
584
|
+
extern ptw32_mcs_lock_t ptw32_cond_test_init_lock;
|
|
585
|
+
extern ptw32_mcs_lock_t ptw32_rwlock_test_init_lock;
|
|
586
|
+
extern ptw32_mcs_lock_t ptw32_spinlock_test_init_lock;
|
|
587
|
+
|
|
588
|
+
#if defined(_UWIN)
|
|
589
|
+
extern int pthread_count;
|
|
590
|
+
#endif
|
|
591
|
+
|
|
592
|
+
#if defined(__cplusplus)
|
|
593
|
+
extern "C"
|
|
594
|
+
{
|
|
595
|
+
#endif /* __cplusplus */
|
|
596
|
+
|
|
597
|
+
/*
|
|
598
|
+
* =====================
|
|
599
|
+
* =====================
|
|
600
|
+
* Forward Declarations
|
|
601
|
+
* =====================
|
|
602
|
+
* =====================
|
|
603
|
+
*/
|
|
604
|
+
|
|
605
|
+
int ptw32_is_attr (const pthread_attr_t * attr);
|
|
606
|
+
|
|
607
|
+
int ptw32_cond_check_need_init (pthread_cond_t * cond);
|
|
608
|
+
int ptw32_mutex_check_need_init (pthread_mutex_t * mutex);
|
|
609
|
+
int ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock);
|
|
610
|
+
int ptw32_spinlock_check_need_init (pthread_spinlock_t * lock);
|
|
611
|
+
|
|
612
|
+
int ptw32_robust_mutex_inherit(pthread_mutex_t * mutex);
|
|
613
|
+
void ptw32_robust_mutex_add(pthread_mutex_t* mutex, pthread_t self);
|
|
614
|
+
void ptw32_robust_mutex_remove(pthread_mutex_t* mutex, ptw32_thread_t* otp);
|
|
615
|
+
|
|
616
|
+
DWORD
|
|
617
|
+
ptw32_RegisterCancelation (PAPCFUNC callback,
|
|
618
|
+
HANDLE threadH, DWORD callback_arg);
|
|
619
|
+
|
|
620
|
+
int ptw32_processInitialize (void);
|
|
621
|
+
|
|
622
|
+
void ptw32_processTerminate (void);
|
|
623
|
+
|
|
624
|
+
void ptw32_threadDestroy (pthread_t tid);
|
|
625
|
+
|
|
626
|
+
void ptw32_pop_cleanup_all (int execute);
|
|
627
|
+
|
|
628
|
+
pthread_t ptw32_new (void);
|
|
629
|
+
|
|
630
|
+
pthread_t ptw32_threadReusePop (void);
|
|
631
|
+
|
|
632
|
+
void ptw32_threadReusePush (pthread_t thread);
|
|
633
|
+
|
|
634
|
+
int ptw32_getprocessors (int *count);
|
|
635
|
+
|
|
636
|
+
int ptw32_setthreadpriority (pthread_t thread, int policy, int priority);
|
|
637
|
+
|
|
638
|
+
void ptw32_rwlock_cancelwrwait (void *arg);
|
|
639
|
+
|
|
640
|
+
#if ! (defined (__MINGW64__) || defined(__MINGW32__)) || (defined(__MSVCRT__) && ! defined(__DMC__))
|
|
641
|
+
unsigned __stdcall
|
|
642
|
+
#else
|
|
643
|
+
void
|
|
644
|
+
#endif
|
|
645
|
+
ptw32_threadStart (void *vthreadParms);
|
|
646
|
+
|
|
647
|
+
void ptw32_callUserDestroyRoutines (pthread_t thread);
|
|
648
|
+
|
|
649
|
+
int ptw32_tkAssocCreate (ptw32_thread_t * thread, pthread_key_t key);
|
|
650
|
+
|
|
651
|
+
void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc);
|
|
652
|
+
|
|
653
|
+
int ptw32_semwait (sem_t * sem);
|
|
654
|
+
|
|
655
|
+
DWORD ptw32_relmillisecs (const struct timespec * abstime);
|
|
656
|
+
|
|
657
|
+
void ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node);
|
|
658
|
+
|
|
659
|
+
int ptw32_mcs_lock_try_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node);
|
|
660
|
+
|
|
661
|
+
void ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node);
|
|
662
|
+
|
|
663
|
+
void ptw32_mcs_node_transfer (ptw32_mcs_local_node_t * new_node, ptw32_mcs_local_node_t * old_node);
|
|
664
|
+
|
|
665
|
+
#if defined(NEED_FTIME)
|
|
666
|
+
void ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft);
|
|
667
|
+
void ptw32_filetime_to_timespec (const FILETIME * ft, struct timespec *ts);
|
|
668
|
+
#endif
|
|
669
|
+
|
|
670
|
+
/* Declared in misc.c */
|
|
671
|
+
#if defined(NEED_CALLOC)
|
|
672
|
+
#define calloc(n, s) ptw32_calloc(n, s)
|
|
673
|
+
void *ptw32_calloc (size_t n, size_t s);
|
|
674
|
+
#endif
|
|
675
|
+
|
|
676
|
+
/* Declared in private.c */
|
|
677
|
+
#if defined(_MSC_VER)
|
|
678
|
+
/*
|
|
679
|
+
* Ignore the warning:
|
|
680
|
+
* "C++ exception specification ignored except to indicate that
|
|
681
|
+
* the function is not __declspec(nothrow)."
|
|
682
|
+
*/
|
|
683
|
+
#pragma warning(disable:4290)
|
|
684
|
+
#endif
|
|
685
|
+
void ptw32_throw (DWORD exception)
|
|
686
|
+
#if defined(__CLEANUP_CXX)
|
|
687
|
+
throw(ptw32_exception_cancel,ptw32_exception_exit)
|
|
688
|
+
#endif
|
|
689
|
+
;
|
|
690
|
+
|
|
691
|
+
#if defined(__cplusplus)
|
|
692
|
+
}
|
|
693
|
+
#endif /* __cplusplus */
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
#if defined(_UWIN_)
|
|
697
|
+
# if defined(_MT)
|
|
698
|
+
# if defined(__cplusplus)
|
|
699
|
+
extern "C"
|
|
700
|
+
{
|
|
701
|
+
# endif
|
|
702
|
+
_CRTIMP unsigned long __cdecl _beginthread (void (__cdecl *) (void *),
|
|
703
|
+
unsigned, void *);
|
|
704
|
+
_CRTIMP void __cdecl _endthread (void);
|
|
705
|
+
_CRTIMP unsigned long __cdecl _beginthreadex (void *, unsigned,
|
|
706
|
+
unsigned (__stdcall *) (void *),
|
|
707
|
+
void *, unsigned, unsigned *);
|
|
708
|
+
_CRTIMP void __cdecl _endthreadex (unsigned);
|
|
709
|
+
# if defined(__cplusplus)
|
|
710
|
+
}
|
|
711
|
+
# endif
|
|
712
|
+
# endif
|
|
713
|
+
#else
|
|
714
|
+
# include <process.h>
|
|
715
|
+
# endif
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
/*
|
|
719
|
+
* Use intrinsic versions wherever possible. VC will do this
|
|
720
|
+
* automatically where possible and GCC define these if available:
|
|
721
|
+
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
|
722
|
+
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
|
723
|
+
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
|
724
|
+
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
|
725
|
+
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
|
726
|
+
*
|
|
727
|
+
* The full set of Interlocked intrinsics in GCC are (check versions):
|
|
728
|
+
* type __sync_fetch_and_add (type *ptr, type value, ...)
|
|
729
|
+
* type __sync_fetch_and_sub (type *ptr, type value, ...)
|
|
730
|
+
* type __sync_fetch_and_or (type *ptr, type value, ...)
|
|
731
|
+
* type __sync_fetch_and_and (type *ptr, type value, ...)
|
|
732
|
+
* type __sync_fetch_and_xor (type *ptr, type value, ...)
|
|
733
|
+
* type __sync_fetch_and_nand (type *ptr, type value, ...)
|
|
734
|
+
* type __sync_add_and_fetch (type *ptr, type value, ...)
|
|
735
|
+
* type __sync_sub_and_fetch (type *ptr, type value, ...)
|
|
736
|
+
* type __sync_or_and_fetch (type *ptr, type value, ...)
|
|
737
|
+
* type __sync_and_and_fetch (type *ptr, type value, ...)
|
|
738
|
+
* type __sync_xor_and_fetch (type *ptr, type value, ...)
|
|
739
|
+
* type __sync_nand_and_fetch (type *ptr, type value, ...)
|
|
740
|
+
* bool __sync_bool_compare_and_swap (type *ptr, type oldval type newval, ...)
|
|
741
|
+
* type __sync_val_compare_and_swap (type *ptr, type oldval type newval, ...)
|
|
742
|
+
* __sync_synchronize (...) // Full memory barrier
|
|
743
|
+
* type __sync_lock_test_and_set (type *ptr, type value, ...) // Acquire barrier
|
|
744
|
+
* void __sync_lock_release (type *ptr, ...) // Release barrier
|
|
745
|
+
*
|
|
746
|
+
* These are all overloaded and take 1,2,4,8 byte scalar or pointer types.
|
|
747
|
+
*
|
|
748
|
+
* The above aren't available in Mingw32 as of gcc 4.5.2 so define our own.
|
|
749
|
+
*/
|
|
750
|
+
#if defined(__GNUC__)
|
|
751
|
+
# if defined(_WIN64)
|
|
752
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_64(location, value, comparand) \
|
|
753
|
+
({ \
|
|
754
|
+
__typeof (value) _result; \
|
|
755
|
+
__asm__ __volatile__ \
|
|
756
|
+
( \
|
|
757
|
+
"lock\n\t" \
|
|
758
|
+
"cmpxchgq %2,(%1)" \
|
|
759
|
+
:"=a" (_result) \
|
|
760
|
+
:"r" (location), "r" (value), "a" (comparand) \
|
|
761
|
+
:"memory", "cc"); \
|
|
762
|
+
_result; \
|
|
763
|
+
})
|
|
764
|
+
# define PTW32_INTERLOCKED_EXCHANGE_64(location, value) \
|
|
765
|
+
({ \
|
|
766
|
+
__typeof (value) _result; \
|
|
767
|
+
__asm__ __volatile__ \
|
|
768
|
+
( \
|
|
769
|
+
"xchgq %0,(%1)" \
|
|
770
|
+
:"=r" (_result) \
|
|
771
|
+
:"r" (location), "0" (value) \
|
|
772
|
+
:"memory", "cc"); \
|
|
773
|
+
_result; \
|
|
774
|
+
})
|
|
775
|
+
# define PTW32_INTERLOCKED_EXCHANGE_ADD_64(location, value) \
|
|
776
|
+
({ \
|
|
777
|
+
__typeof (value) _result; \
|
|
778
|
+
__asm__ __volatile__ \
|
|
779
|
+
( \
|
|
780
|
+
"lock\n\t" \
|
|
781
|
+
"xaddq %0,(%1)" \
|
|
782
|
+
:"=r" (_result) \
|
|
783
|
+
:"r" (location), "0" (value) \
|
|
784
|
+
:"memory", "cc"); \
|
|
785
|
+
_result; \
|
|
786
|
+
})
|
|
787
|
+
# define PTW32_INTERLOCKED_INCREMENT_64(location) \
|
|
788
|
+
({ \
|
|
789
|
+
PTW32_INTERLOCKED_LONG _temp = 1; \
|
|
790
|
+
__asm__ __volatile__ \
|
|
791
|
+
( \
|
|
792
|
+
"lock\n\t" \
|
|
793
|
+
"xaddq %0,(%1)" \
|
|
794
|
+
:"+r" (_temp) \
|
|
795
|
+
:"r" (location) \
|
|
796
|
+
:"memory", "cc"); \
|
|
797
|
+
++_temp; \
|
|
798
|
+
})
|
|
799
|
+
# define PTW32_INTERLOCKED_DECREMENT_64(location) \
|
|
800
|
+
({ \
|
|
801
|
+
PTW32_INTERLOCKED_LONG _temp = -1; \
|
|
802
|
+
__asm__ __volatile__ \
|
|
803
|
+
( \
|
|
804
|
+
"lock\n\t" \
|
|
805
|
+
"xaddq %2,(%1)" \
|
|
806
|
+
:"+r" (_temp) \
|
|
807
|
+
:"r" (location) \
|
|
808
|
+
:"memory", "cc"); \
|
|
809
|
+
--_temp; \
|
|
810
|
+
})
|
|
811
|
+
#endif
|
|
812
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG(location, value, comparand) \
|
|
813
|
+
({ \
|
|
814
|
+
__typeof (value) _result; \
|
|
815
|
+
__asm__ __volatile__ \
|
|
816
|
+
( \
|
|
817
|
+
"lock\n\t" \
|
|
818
|
+
"cmpxchgl %2,(%1)" \
|
|
819
|
+
:"=a" (_result) \
|
|
820
|
+
:"r" (location), "r" (value), "a" (comparand) \
|
|
821
|
+
:"memory", "cc"); \
|
|
822
|
+
_result; \
|
|
823
|
+
})
|
|
824
|
+
# define PTW32_INTERLOCKED_EXCHANGE_LONG(location, value) \
|
|
825
|
+
({ \
|
|
826
|
+
__typeof (value) _result; \
|
|
827
|
+
__asm__ __volatile__ \
|
|
828
|
+
( \
|
|
829
|
+
"xchgl %0,(%1)" \
|
|
830
|
+
:"=r" (_result) \
|
|
831
|
+
:"r" (location), "0" (value) \
|
|
832
|
+
:"memory", "cc"); \
|
|
833
|
+
_result; \
|
|
834
|
+
})
|
|
835
|
+
# define PTW32_INTERLOCKED_EXCHANGE_ADD_LONG(location, value) \
|
|
836
|
+
({ \
|
|
837
|
+
__typeof (value) _result; \
|
|
838
|
+
__asm__ __volatile__ \
|
|
839
|
+
( \
|
|
840
|
+
"lock\n\t" \
|
|
841
|
+
"xaddl %0,(%1)" \
|
|
842
|
+
:"=r" (_result) \
|
|
843
|
+
:"r" (location), "0" (value) \
|
|
844
|
+
:"memory", "cc"); \
|
|
845
|
+
_result; \
|
|
846
|
+
})
|
|
847
|
+
# define PTW32_INTERLOCKED_INCREMENT_LONG(location) \
|
|
848
|
+
({ \
|
|
849
|
+
PTW32_INTERLOCKED_LONG _temp = 1; \
|
|
850
|
+
__asm__ __volatile__ \
|
|
851
|
+
( \
|
|
852
|
+
"lock\n\t" \
|
|
853
|
+
"xaddl %0,(%1)" \
|
|
854
|
+
:"+r" (_temp) \
|
|
855
|
+
:"r" (location) \
|
|
856
|
+
:"memory", "cc"); \
|
|
857
|
+
++_temp; \
|
|
858
|
+
})
|
|
859
|
+
# define PTW32_INTERLOCKED_DECREMENT_LONG(location) \
|
|
860
|
+
({ \
|
|
861
|
+
PTW32_INTERLOCKED_LONG _temp = -1; \
|
|
862
|
+
__asm__ __volatile__ \
|
|
863
|
+
( \
|
|
864
|
+
"lock\n\t" \
|
|
865
|
+
"xaddl %0,(%1)" \
|
|
866
|
+
:"+r" (_temp) \
|
|
867
|
+
:"r" (location) \
|
|
868
|
+
:"memory", "cc"); \
|
|
869
|
+
--_temp; \
|
|
870
|
+
})
|
|
871
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_PTR(location, value, comparand) \
|
|
872
|
+
PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE((PTW32_INTERLOCKED_SIZEPTR)location, \
|
|
873
|
+
(PTW32_INTERLOCKED_SIZE)value, \
|
|
874
|
+
(PTW32_INTERLOCKED_SIZE)comparand)
|
|
875
|
+
# define PTW32_INTERLOCKED_EXCHANGE_PTR(location, value) \
|
|
876
|
+
PTW32_INTERLOCKED_EXCHANGE_SIZE((PTW32_INTERLOCKED_SIZEPTR)location, \
|
|
877
|
+
(PTW32_INTERLOCKED_SIZE)value)
|
|
878
|
+
#else
|
|
879
|
+
# if defined(_WIN64)
|
|
880
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_64 InterlockedCompareExchange64
|
|
881
|
+
# define PTW32_INTERLOCKED_EXCHANGE_64 InterlockedExchange64
|
|
882
|
+
# define PTW32_INTERLOCKED_EXCHANGE_ADD_64 InterlockedExchangeAdd64
|
|
883
|
+
# define PTW32_INTERLOCKED_INCREMENT_64 InterlockedIncrement64
|
|
884
|
+
# define PTW32_INTERLOCKED_DECREMENT_64 InterlockedDecrement64
|
|
885
|
+
# endif
|
|
886
|
+
# if defined(_MSC_VER) && _MSC_VER < 1300 && !defined(_WIN64) /* MSVC 6 */
|
|
887
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG(location, value, comparand) \
|
|
888
|
+
((LONG)InterlockedCompareExchange((PVOID *)(location), (PVOID)(value), (PVOID)(comparand)))
|
|
889
|
+
# else
|
|
890
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG InterlockedCompareExchange
|
|
891
|
+
# endif
|
|
892
|
+
# define PTW32_INTERLOCKED_EXCHANGE_LONG InterlockedExchange
|
|
893
|
+
# define PTW32_INTERLOCKED_EXCHANGE_ADD_LONG InterlockedExchangeAdd
|
|
894
|
+
# define PTW32_INTERLOCKED_INCREMENT_LONG InterlockedIncrement
|
|
895
|
+
# define PTW32_INTERLOCKED_DECREMENT_LONG InterlockedDecrement
|
|
896
|
+
# if defined(_MSC_VER) && _MSC_VER < 1300 && !defined(_WIN64) /* MSVC 6 */
|
|
897
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_PTR InterlockedCompareExchange
|
|
898
|
+
# define PTW32_INTERLOCKED_EXCHANGE_PTR(location, value) \
|
|
899
|
+
((PVOID)InterlockedExchange((LPLONG)(location), (LONG)(value)))
|
|
900
|
+
# else
|
|
901
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_PTR InterlockedCompareExchangePointer
|
|
902
|
+
# define PTW32_INTERLOCKED_EXCHANGE_PTR InterlockedExchangePointer
|
|
903
|
+
# endif
|
|
904
|
+
#endif
|
|
905
|
+
#if defined(_WIN64)
|
|
906
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE PTW32_INTERLOCKED_COMPARE_EXCHANGE_64
|
|
907
|
+
# define PTW32_INTERLOCKED_EXCHANGE_SIZE PTW32_INTERLOCKED_EXCHANGE_64
|
|
908
|
+
# define PTW32_INTERLOCKED_EXCHANGE_ADD_SIZE PTW32_INTERLOCKED_EXCHANGE_ADD_64
|
|
909
|
+
# define PTW32_INTERLOCKED_INCREMENT_SIZE PTW32_INTERLOCKED_INCREMENT_64
|
|
910
|
+
# define PTW32_INTERLOCKED_DECREMENT_SIZE PTW32_INTERLOCKED_DECREMENT_64
|
|
911
|
+
#else
|
|
912
|
+
# define PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG
|
|
913
|
+
# define PTW32_INTERLOCKED_EXCHANGE_SIZE PTW32_INTERLOCKED_EXCHANGE_LONG
|
|
914
|
+
# define PTW32_INTERLOCKED_EXCHANGE_ADD_SIZE PTW32_INTERLOCKED_EXCHANGE_ADD_LONG
|
|
915
|
+
# define PTW32_INTERLOCKED_INCREMENT_SIZE PTW32_INTERLOCKED_INCREMENT_LONG
|
|
916
|
+
# define PTW32_INTERLOCKED_DECREMENT_SIZE PTW32_INTERLOCKED_DECREMENT_LONG
|
|
917
|
+
#endif
|
|
918
|
+
|
|
919
|
+
#if defined(NEED_CREATETHREAD)
|
|
920
|
+
|
|
921
|
+
/*
|
|
922
|
+
* Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
|
|
923
|
+
* in order to avoid warnings because of return type
|
|
924
|
+
*/
|
|
925
|
+
|
|
926
|
+
#define _beginthreadex(security, \
|
|
927
|
+
stack_size, \
|
|
928
|
+
start_proc, \
|
|
929
|
+
arg, \
|
|
930
|
+
flags, \
|
|
931
|
+
pid) \
|
|
932
|
+
CreateThread(security, \
|
|
933
|
+
stack_size, \
|
|
934
|
+
(LPTHREAD_START_ROUTINE) start_proc, \
|
|
935
|
+
arg, \
|
|
936
|
+
flags, \
|
|
937
|
+
pid)
|
|
938
|
+
|
|
939
|
+
#define _endthreadex ExitThread
|
|
940
|
+
|
|
941
|
+
#endif /* NEED_CREATETHREAD */
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
#endif /* _IMPLEMENT_H */
|