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
	}
예제 #2
0
파일: thread.c 프로젝트: randombit/hacrypto
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
}