[Swift-commit] cog r3859
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Tue Jan 21 21:30:04 CST 2014
------------------------------------------------------------------------
r3859 | hategan | 2014-01-21 21:29:04 -0600 (Tue, 21 Jan 2014) | 1 line
release lock before calling pthread_join
------------------------------------------------------------------------
Index: modules/provider-coaster-c-client/src/CoasterLoop.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterLoop.cpp (revision 3858)
+++ modules/provider-coaster-c-client/src/CoasterLoop.cpp (working copy)
@@ -50,14 +50,20 @@
started = true;
}
-void CoasterLoop::stop() { Lock::Scoped l(lock);
- if (!started) {
- return;
+void CoasterLoop::stop() {
+ { Lock::Scoped l(lock);
+ if (!started) {
+ return;
+ }
+ LogInfo << "Stopping coaster loop" << endl;
+ done = true;
+ // make sure we are not stuck in select()
+ requestWrite(1);
}
- LogInfo << "Stopping coaster loop" << endl;
- done = true;
- // make sure we are not stuck in select()
- requestWrite(1);
+ /*
+ * must release lock before calling pthread_join
+ * in case run() is waiting for the lock
+ */
pthread_join(thread, NULL);
LogInfo << "Coaster loop stopped" << endl;
}
More information about the Swift-commit
mailing list