Re: [Opalvoip-devel] PServiceProcess questions
Brought to you by:
csoutheren,
rjongbloed
From: Robert J. <ro...@vo...> - 2016-08-12 15:31:16
|
That is correct. I can't remember the reasons any more, but it is deliberate. See documentation: /** Called by the system when the service is stopped. One return from this function there is no guarantee that any more user code will be executed. Any cleaning up or closing of resource must be done in here. Default behaviour signals the m_exitMain to exit Main(). */ virtual void OnStop(); So, do not use a destructor to clean anything up in a PServiceProcess. ---------- Robert Jongbloed Vox Lucida Pty. Ltd. -----Original message----- From: Елена Валынец Sent: Thursday, 11th August 2016, 14:00 To: opa...@li... Subject: [Opalvoip-devel] PServiceProcess questions Hello! PTLib V3.16 Procyon, OS x86_64 GNU/Linux I use PServiceProcess as base class for daemon implementation. And it seems that m_processID field saves parent value in the child process after fork(). Why is Terminate() function called at the end? It couses exit and prevents calling the destructor of PServiceProcess. int PServiceProcess::InternalMain(void *) { if ((terminationValue = InitialiseService()) < 0) { // Make sure housekeeping thread is going so signals are handled. SignalTimerChange(); terminationValue = 1; if (OnStart()) { terminationValue = 0; Main(); Terminate(); } } return terminationValue; } Best regards Elena ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev <http://sdm.link/zohodev2dev> _______________________________________________ Opalvoip-devel mailing list Opa...@li... <mailto:Opa...@li...> https://lists.sourceforge.net/lists/listinfo/opalvoip-devel |