added error message when thread creation fails

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4112 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-03-30 22:32:13 +00:00
parent 5028b749e6
commit 6edee55e57

View File

@ -27,6 +27,8 @@
#include "rsthreads.h" #include "rsthreads.h"
#include <unistd.h> /* for usleep() */ #include <unistd.h> /* for usleep() */
#include <errno.h> /* for usleep() */
#include <iostream>
/******* /*******
* #define DEBUG_THREADS 1 * #define DEBUG_THREADS 1
@ -71,8 +73,12 @@ pthread_t createThread(RsThread &thread)
pthread_create(&tid, &tattr, &rsthread_init, data); pthread_create(&tid, &tattr, &rsthread_init, data);
#endif #endif
pthread_create(&tid, 0, &rsthread_init, data); int err ;
if( 0 == (err=pthread_create(&tid, 0, &rsthread_init, data)))
thread.mTid = tid; thread.mTid = tid;
else
std::cerr << "Fatal error: pthread_create could not create a thread. Error returned: " << err << " !!!!!!!" << std::endl;
} }
thread.mMutex.unlock(); thread.mMutex.unlock();