From 6edee55e57bdd194ecaa840a62e8923cde0c182f Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 Mar 2011 22:32:13 +0000 Subject: [PATCH] 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 --- libretroshare/src/util/rsthreads.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/util/rsthreads.cc b/libretroshare/src/util/rsthreads.cc index e18eb1905..eeb61fff1 100644 --- a/libretroshare/src/util/rsthreads.cc +++ b/libretroshare/src/util/rsthreads.cc @@ -27,6 +27,8 @@ #include "rsthreads.h" #include /* for usleep() */ +#include /* for usleep() */ +#include /******* * #define DEBUG_THREADS 1 @@ -71,8 +73,12 @@ pthread_t createThread(RsThread &thread) pthread_create(&tid, &tattr, &rsthread_init, data); #endif - pthread_create(&tid, 0, &rsthread_init, data); - thread.mTid = tid; + int err ; + + if( 0 == (err=pthread_create(&tid, 0, &rsthread_init, data))) + thread.mTid = tid; + else + std::cerr << "Fatal error: pthread_create could not create a thread. Error returned: " << err << " !!!!!!!" << std::endl; } thread.mMutex.unlock();