[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] static Object management (win32??)



Martin Johnson wrote:
Hi Michele, Marcel

Hope your both well. I notice your extremely busy at the moment. Well done
on the latest release.
Sorry I couldnt help your colleague with vc7 project.


There also seems to be some problem with the clean up of the static

Global.

The various semaphores etc are invalid shortly after main is left (so it
would seem) and waiters are not woken as such. This just make the Timeout
cleanup go into a tight loop forever.



I have looked at this further, I notice that you have even catered for it by
defining out calls that you feel block forever. The static global semantics
appears as follows. They have their destructors called as part of the
runtime cleanup procedure from _DllMainCRTStartup (DLL_PROCESS_DETACH). The
problem here is this is as result of a call TerminateProcess. Between
TerminateProcess and the DLL_PROCESS_DETACH message all threads bar the main
are terminated. So any code that is going to expect notification from
threads will no longer work. A exit status could be evaluated prior to
waiting on mutex's etc with locally created objects.could assist. This would
only fix some code. CorbaDriverFactory has the #define to skip code entirely
for this reason. A means of Object management is required to support the
object lifetimes etc.. This would probably require the offending objects
becoming pointers instead of statics which to my mind is no big deal. As it
stands now its broken. Do you feel this is an option? What do you think?

Hi Martin,

nice to hear from you.

I'm not sure if i understood everything, but this is my point of view:

Singletons / non-const-statics are always a pain as the life cycle is
determined by the C++ specification and/or compiler/linker specific
implementations.

Having only objects and handle creation and cleanup ourself is
the best way to approach such issue.

If you are willing to get rid of our few singletons/non-const-static
i would be happy.

regards,

Marcel