--- In [email protected], "brucexs" <bswit...@...> wrote:

> The freelibrary does not happen until after the unload service returns.


> I am not clear on what you mean by "event when thread is done".  Do you have 
> another event that thread signals?  Or is the main event just waiting for the 
> worker thread to exit (I cannot remember if this is possible).

At moment, exactly as you describe.  There are two events, one
used by worker thread to signal it's done for now, and on which the main thread 
waits when it's set worker thread in motion (and one by main thread to signal 
to worker that it's time to go, and on which worker thread waits when it has 
nothing to do).  In special case of unload, worker thread signals it's done, 
then exits: but there's
a few lines of code between the signalling and the exit.  Could get stuck there.

 
> If the first,  maybe what is happening is
> - main thread sets event
> - worker thread finishes and sets another event but it is still running
> - main thread returns and freelibrary is called while worker thread is still 
> running

> Does that sound like it?

Yeah.  Hmm.  Maybe if I give worker thread higher priority than main thread?  
At the moment they just get whatever priority they get...
okay, let me go check that out. 


> > The alternative is to leave things as they are, and require users to always 
> > call com.unload in PProShutdown list.

> The alternative of always calling com.unload sounds easiest for users to me.

Okay, suits me, but let me see if tinkering with thread priorites will do the 
trick.

Or, I could wait, as you imply in your further reply, on worker thread shutting 
down instead of on it signalling.  I don't know if that's possible either, but 
I'll check.  Thanks for suggestion.



Reply via email to