#include #include #include void *runFunction (void *pvPThread) { std:: cout << "Inside the thread" << std:: endl; Sleep (300); return (void *) NULL; } int main () { pthread_t _pThread; pthread_attr_t _pThreadAttribute; for (long lIndex = 0; lIndex < 1000; lIndex++) { std:: cout << "Index: " << lIndex << std:: endl; std:: cout << pthread_attr_init (&_pThreadAttribute) << std:: endl; std:: cout << pthread_attr_setdetachstate (&_pThreadAttribute, PTHREAD_CREATE_DETACHED) << std:: endl; std:: cout << pthread_create (&_pThread, &_pThreadAttribute, runFunction, NULL) << std:: endl; // std:: cout << pthread_join (_pThread, &pvStatus) << std:: endl; std:: cout << pthread_attr_destroy (&_pThreadAttribute) << std:: endl; Sleep (300); } Sleep (1000 * 1000); return 0; }