We can improve/reduce code by collapsing those two into one internal function: src/thread.c: > TCN_IMPLEMENT_CALL(jlong, Thread, current)(TCN_STDARGS) > { > UNREFERENCED_STDARGS; > return (jlong)((unsigned long)apr_os_thread_current()); > } and src/ssl.c: > static unsigned long ssl_thread_id(void) > { > /* OpenSSL needs this to return an unsigned long. On OS/390, the pthread > * id is a structure twice that big. Use the TCB pointer instead as a > * unique unsigned long. > */ > #ifdef __MVS__ > struct PSA { > char unmapped[540]; > unsigned long PSATOLD; > } *psaptr = 0; > > return psaptr->PSATOLD; > #elif defined(WIN32) > return (unsigned long)GetCurrentThreadId(); > #elif defined(DARWIN) > uint64_t tid; > pthread_threadid_np(NULL, &tid); > return (unsigned long)tid; > #elif defined(__FreeBSD__) > return (unsigned long)pthread_getthreadid_np(); > #elif defined(__linux__) > return (unsigned long)syscall(SYS_gettid); > #else > return (unsigned long)(apr_os_thread_current()); > #endif > } I think that we can throw away the apr_os_thread_current() because we already have the thread id for Windows and for Unix is it merely: > APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) > { > return pthread_self(); > } There are implementations for BeOS, Netware and OS/2, but we don't care for them.
Fixed in: - master for 1.2.24 onwards