Robert Szokovacs wrote:
On Wednesday 22 April 2009 11:17:41 you wrote:
Raphael Coeffic wrote:
If I do it asynchronously, is it guaranteed that my stuff will finish?
Yes. All you have to do is to remove your helper thread from the
AmEventDispatcher at last. A quick look at
AmSessionContainer::on_stop() will convince you for sure ;-)
The only issue would be that you have to clean the memory as well. The
memory for the sessions get cleaned by AmSessionContainer. In your
case, you could use AmThreadWatcher (AmThread.h). It implements a
garbage collector that deletes your instance as soon as it is stopped
(+ some delay, because the garbage collector only runs every 10 seconds).
Hooops! I just looked at the code, and following issue raised:
AmThreadWatcher is not included in the shutdown process. This means that
there will be a race condition between you thread beeing cleaned up and
the death of the process. If you can live with this, then go ahead!
If I understand correctly, this is not really a problem, the process will die
anyway, so reclaiming the memory is not important.
Some people use an instance counter that gets decremented in the
destructor to track memory leak. In your case, it is possible that the
destructor never gets called. If this is of no interest for you, then
yes, you don't care.
-Raphael.
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev