Date: Thursday, November 30, 2006 @ 17:12:24
Author: gilles
Path: /cvsroot/carob/carob/src
Modified: ControllerPool.cpp (1.9 -> 1.10) ControllerWatcher.cpp (1.3 ->
1.4)
Rollback thread detachement, waiting for better fix to speed problems
-----------------------+
ControllerPool.cpp | 7 ++++++-
ControllerWatcher.cpp | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
Index: carob/src/ControllerPool.cpp
diff -u carob/src/ControllerPool.cpp:1.9 carob/src/ControllerPool.cpp:1.10
--- carob/src/ControllerPool.cpp:1.9 Thu Nov 30 15:22:29 2006
+++ carob/src/ControllerPool.cpp Thu Nov 30 17:12:23 2006
@@ -67,7 +67,6 @@
watcher_ptr = new ControllerWatcher(controllerList, *callback_ptr,
pingDelayInMs, controllerTimeoutInMs);
pthread_create(&watcher_thread, NULL, ControllerWatcherThread,
watcher_ptr);
- pthread_detach(watcher_thread);
}
catch (ConnectionException cause)
{
@@ -79,6 +78,12 @@
AbstractControllerPool::~AbstractControllerPool()
{
watcher_ptr->stop();
+ int err = pthread_join(watcher_thread, NULL);
+ if (err && isErrorEnabled())
+ {
+ logError(L"AbstractControllerPool::~AbstractControllerPool",
+ L"Failed to join watcher thread");
+ }
delete(watcher_ptr);
delete(callback_ptr);
alive_controllers.clear();
Index: carob/src/ControllerWatcher.cpp
diff -u carob/src/ControllerWatcher.cpp:1.3 carob/src/ControllerWatcher.cpp:1.4
--- carob/src/ControllerWatcher.cpp:1.3 Thu Nov 30 15:22:29 2006
+++ carob/src/ControllerWatcher.cpp Thu Nov 30 17:12:23 2006
@@ -86,13 +86,18 @@
pinger_ptr = new ControllerPingSender(*controllers_ptr, socket_fd,
ping_delay_in_ms);
pthread_create(&pinger_thread, NULL, PingSenderThread, pinger_ptr);
- pthread_detach(pinger_thread);
}
ControllerWatcher::~ControllerWatcher()
{
// stop the pinger thread
pinger_ptr->stop();
+ int err = pthread_join(pinger_thread, NULL);
+ if (err && isErrorEnabled())
+ {
+ logError(L"ControllerWatcher::~ControllerWatcher",
+ L"Failed to join pinger thread");
+ }
close(socket_fd);
delete(pinger_ptr);
delete(controllers_ptr);
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits