X-Git-Url: https://git.saurik.com/apple/libpthread.git/blobdiff_plain/c6e5f90c4dd303939f631da331df7b356da942e6..4d9153646b79616988baf143c3597b37a778e989:/src/pthread_dependency.c?ds=sidebyside diff --git a/src/pthread_dependency.c b/src/pthread_dependency.c index 3836f15..a907ac0 100644 --- a/src/pthread_dependency.c +++ b/src/pthread_dependency.c @@ -23,22 +23,10 @@ #include "resolver.h" #include "internal.h" -#include "dependency_private.h" -#include #define PREREQUISITE_FULFILLED (~0u) -PTHREAD_NOEXPORT -void _pthread_dependency_fulfill_slow(pthread_dependency_t *pr, uint32_t old); - -OS_ALWAYS_INLINE -static inline mach_port_t -_pthread_dependency_self(void) -{ - void *v = _pthread_getspecific_direct(_PTHREAD_TSD_SLOT_MACH_THREAD_SELF); - return (mach_port_t)(uintptr_t)v; -} - +#if !VARIANT_DYLD void pthread_dependency_init_np(pthread_dependency_t *pr, pthread_t pth, pthread_dependency_attr_t *attrs) @@ -54,7 +42,7 @@ _pthread_dependency_fulfill_slow(pthread_dependency_t *pr, uint32_t old) if (old == PREREQUISITE_FULFILLED) { PTHREAD_CLIENT_CRASH(0, "Fufilling pthread_dependency_t twice"); } - if (os_unlikely(old != _pthread_dependency_self())) { + if (os_unlikely(old != _pthread_mach_thread_self_direct())) { PTHREAD_CLIENT_CRASH(old, "Fulfilled a dependency " "not owned by current thread"); } @@ -70,6 +58,7 @@ _pthread_dependency_fulfill_slow(pthread_dependency_t *pr, uint32_t old) } +PTHREAD_NOEXPORT_VARIANT void pthread_dependency_fulfill_np(pthread_dependency_t *pr, void *value) { @@ -81,6 +70,7 @@ pthread_dependency_fulfill_np(pthread_dependency_t *pr, void *value) if (old != 0) _pthread_dependency_fulfill_slow(pr, old); } +PTHREAD_NOEXPORT_VARIANT void * pthread_dependency_wait_np(pthread_dependency_t *pr) { @@ -109,3 +99,16 @@ pthread_dependency_wait_np(pthread_dependency_t *pr) PTHREAD_CLIENT_CRASH(cur, "Corrupted pthread_dependency_t"); } +PTHREAD_NOEXPORT_VARIANT void* +_pthread_atomic_xchg_ptr(void **p, void *v) +{ + return os_atomic_xchg(p, v, seq_cst); +} + +PTHREAD_NOEXPORT_VARIANT uint32_t +_pthread_atomic_xchg_uint32_relaxed(uint32_t *p, uint32_t v) +{ + return os_atomic_xchg(p, v, relaxed); +} + +#endif // !VARIANT_DYLD