Re: [twsocket] Correct shutdown/abort procedure

2010-05-13 Thread Pete Williams

Thanks for the tip Arno.

I was calling abort, but then going on to free the components after the Abort.

I'll add a delay, and a custom message as you advise.

Pete

> From: arno.garr...@gmx.de
> To: twsocket@elists.org
> Date: Thu, 13 May 2010 15:12:20 +0200
> Subject: Re: [twsocket] Correct shutdown/abort procedure
> 
> Pete Williams wrote:
> 
> > At any point, an account may be requested to stop.
> > 
> > What is the correct way to say to these 2 components 'stop whatever
> > you are doing, clean up and quit'?
> > 
> > The thread that the components exist in continues to run.
> > 
> > The problem I have is that sometimes after they've stopped, I get
> > GPFs in the message pump that these used to exist in - sometimes
> > immediately, sometimes after a delay of several minutes.  
> 
> In order to abort and stop them as fast as possible call Abort.
> Abort most likely will trigger other events, setting all event handlers
> to nil prevents this. Since an instance may not be freed from its own
> event handlers one has to PostThreadMessage() a custom message, and
> free the object when this message is handled. The thread requires a 
> custom message pump.
> 
> --
> Arno Garrels
> 
> 
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Correct shutdown/abort procedure

2010-05-13 Thread Arno Garrels
Pete Williams wrote:

> At any point, an account may be requested to stop.
> 
> What is the correct way to say to these 2 components 'stop whatever
> you are doing, clean up and quit'?
> 
> The thread that the components exist in continues to run.
> 
> The problem I have is that sometimes after they've stopped, I get
> GPFs in the message pump that these used to exist in - sometimes
> immediately, sometimes after a delay of several minutes.  

In order to abort and stop them as fast as possible call Abort.
Abort most likely will trigger other events, setting all event handlers
to nil prevents this. Since an instance may not be freed from its own
event handlers one has to PostThreadMessage() a custom message, and
free the object when this message is handled. The thread requires a 
custom message pump.

--
Arno Garrels


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be