Date: Wednesday, January 10, 2007 @ 18:22:33
Author: marc
Path: /cvsroot/carob/carob/src
Modified: ControllerWatcher.cpp (1.12 -> 1.13)
Moved deletion of fields into destructor
-----------------------+
ControllerWatcher.cpp | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
Index: carob/src/ControllerWatcher.cpp
diff -u carob/src/ControllerWatcher.cpp:1.12
carob/src/ControllerWatcher.cpp:1.13
--- carob/src/ControllerWatcher.cpp:1.12 Wed Jan 10 18:06:45 2007
+++ carob/src/ControllerWatcher.cpp Wed Jan 10 18:22:33 2007
@@ -50,15 +50,6 @@
// Function has finished, it means that we were stopped, so we have to clean
// everything:
- // stop the pinger thread
- self->getControllerPingSenderPtr()->stop();
- // wait for the pinger to finish
- pthread_join(self->getPingerThread(), NULL);
- // pinger has finished, we can close socket...
- close(self->getSocketFd());
- // ...and delete everything
- delete(self->getControllerPingSenderPtr());
- delete(self->getControllersPtr());
delete self;
pthread_exit(NULL);
@@ -123,7 +114,19 @@
ControllerWatcher::~ControllerWatcher()
{
- // Clean-up is done in the C function
+ // we should be called only when run() is over:
+ // objects in use should not be deleted!
+
+ // stop the pinger thread
+ getControllerPingSenderPtr()->stop();
+ // wait for the pinger to finish
+ pthread_join(getPingerThread(), NULL);
+ // pinger has finished, we can close socket...
+ close(getSocketFd());
+ // ...and delete everything
+ delete(getControllerPingSenderPtr());
+ delete(getControllersPtr());
+
}
void ControllerWatcher::processAnswers()
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits