void CRYPTO_THREADID_current(CRYPTO_THREADID *id) { if (threadid_callback) { threadid_callback(id); return; } #ifndef OPENSSL_NO_DEPRECATED /* If the deprecated callback was set, fall back to that */ if (id_callback) { CRYPTO_THREADID_set_numeric(id, id_callback()); return; } #endif /* Else pick a backup */ #ifdef OPENSSL_SYS_WIN16 CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask()); #elif defined(OPENSSL_SYS_WIN32) CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); #elif defined(OPENSSL_SYS_BEOS) CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); #else /* For everything else, default to using the address of 'errno' */ CRYPTO_THREADID_set_pointer(id, (void*)&errno); #endif }
static void pthreads_thread_id(CRYPTO_THREADID *tid) { #if !defined(_MSC_VER) CRYPTO_THREADID_set_numeric(tid, (unsigned long)pthread_self()); #else CRYPTO_THREADID_set_pointer(tid, pthread_self().p); #endif }
static void threadIdCallback(CRYPTO_THREADID * id) { /// ACE_thread_t turns out to be a struct under Mac OS. #ifndef __APPLE__ CRYPTO_THREADID_set_numeric(id, ACE_Thread::self()); #else CRYPTO_THREADID_set_pointer(id, ACE_Thread::self()); #endif }
static void cb_openssl_threadid(CRYPTO_THREADID *tid) { pthread_t me; me = pthread_self(); if (sizeof(me) == sizeof(void *)) CRYPTO_THREADID_set_pointer(tid, (void *) me); else CRYPTO_THREADID_set_numeric(tid, (unsigned long) me); }
static void janus_dtls_cb_openssl_threadid(CRYPTO_THREADID *tid) { /* FIXME Assuming pthread, which is fine as GLib wraps pthread and * so that's what we use anyway? */ pthread_t me = pthread_self(); if(sizeof(me) == sizeof(void *)) { CRYPTO_THREADID_set_pointer(tid, (void *) me); } else { CRYPTO_THREADID_set_numeric(tid, (unsigned long) me); } }
void CRYPTO_THREADID_current(CRYPTO_THREADID *id) { if (threadid_callback) { threadid_callback(id); return; } #if defined(OPENSSL_WINDOWS) CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); #else /* For everything else, default to using the address of 'errno' */ CRYPTO_THREADID_set_pointer(id, (void *)&errno); #endif }
static void ossl_threadid_func(CRYPTO_THREADID *id) { /* register native thread id */ CRYPTO_THREADID_set_pointer(id, (void *)rb_nativethread_self()); }