[Swift-commit] cog r3860
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Wed Jan 22 13:40:03 CST 2014
------------------------------------------------------------------------
r3860 | hategan | 2014-01-22 13:38:22 -0600 (Wed, 22 Jan 2014) | 1 line
fixed thread creation and throw exceptions if any of the thread operations fail
------------------------------------------------------------------------
Index: modules/provider-coaster-c-client/src/CoasterLoop.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterLoop.cpp (revision 3859)
+++ modules/provider-coaster-c-client/src/CoasterLoop.cpp (working copy)
@@ -45,7 +45,9 @@
FD_SET(wakePipe[0], &rfds);
updateMaxFD();
- thread = pthread_create(&thread, NULL, run, this);
+ if (pthread_create(&thread, NULL, run, this) != 0) {
+ throw CoasterError(string("Could not create thread: ") + strerror(errno));
+ }
started = true;
}
@@ -64,7 +66,9 @@
* must release lock before calling pthread_join
* in case run() is waiting for the lock
*/
- pthread_join(thread, NULL);
+ if (pthread_join(thread, NULL) != 0) {
+ throw CoasterError(string("Could not join thread: ") + strerror(errno));
+ }
LogInfo << "Coaster loop stopped" << endl;
}
More information about the Swift-commit
mailing list