#include #include void Sleep(unsigned long ulMilliseconds) { struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = ulMilliseconds * 1000; select(1, NULL, NULL, NULL, &timeout); } static void* threadFunc( void* lpParam ) { Sleep(3000); } int main() { pthread_attr_t attr; int n; bool res = false; if ( (n = ::pthread_attr_init(&attr)) != 0) { return -1; } pthread_t tid; if ( (n = ::pthread_create(&tid, &attr, threadFunc, 0)) == 0) { res = true; } if ( (n = ::pthread_attr_destroy(&attr)) != 0) { return -2; } if (!res) { return -3; } Sleep(5000); return 0; }