To check the detach status in function apr_threadattr_detach_get, there's this test:
if (state == 1) Docs say 'state' will be set to PTHREAD_CREATE_DETACHED when attributes are for a detached thread. PTHREAD_CREATE_DETACHED is defined to 1 on Linux and 2 on OS X. So the test works fine on Linux but not on OS X. Why not just do this: if (state == PTHREAD_CREATE_DETACHED) D.