> On Sept. 21, 2012, 7:22 p.m., Chug Rolke wrote:
> > I ran this patch with extra OutputDebugString calls when the new logic 
> > checks threadSafeShutdown. 
> > 
> > In a typical client program like drain threadSafeShutdown is false every 
> > time as expected for IOThreads and for WinSockSetup.
> > 
> > On the windows broker only ~WinSockSetup checks the threadSafeShutdown. 
> > Should the broker threads check for safe shutdown too?

No.  The broker code creates and destroys these resources in the context of 
main(), before main() returns or exit().

threadSafeShutdown() only returns meaningful info if called after the C++ 
runtime has started its housecleaning for the DLL.  In practice that means if 
called from an atexit() routine (not used in Qpid), or from a static destructor.

Unlike the broker, the client library uses a static destructor ("static 
IOThread io...") to "know" when to clean up.


- Cliff


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/7179/#review11796
-----------------------------------------------------------


On Sept. 19, 2012, 8:32 p.m., Cliff Jansen wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/7179/
> -----------------------------------------------------------
> 
> (Updated Sept. 19, 2012, 8:32 p.m.)
> 
> 
> Review request for qpid, Andrew Stitcher, Chug Rolke, and Steve Huston.
> 
> 
> Description
> -------
> 
> This patch introduces a primitive 
> qpid::sys::SystemInfo::threadSafeShutdown().  It always returns true on Linux 
> and Solaris.  On Windows, it returns true for FreeLibrary and false if exit() 
> has been called, main() returns, or the Qpid libraries have been statically 
> linked.
> 
> It is used to fix the noted static destructor problems in the main Jira.
> 
> Most of the work is plumbing related to obtain knowledge of how the module is 
> terminated in time to be useful to the consumer of the threadSafeShutdown 
> call.
> 
> 
> This addresses bug qpid-4330.
>     https://issues.apache.org/jira/browse/qpid-4330
> 
> 
> Diffs
> -----
> 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/include/qpid/sys/SystemInfo.h
>  1387463 
>   http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/CMakeLists.txt 
> 1387463 
>   http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/Makefile.am 1387463 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
>  1387463 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/client/windows/ClientDllMain.cpp
>  PRE-CREATION 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp
>  1387463 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/sys/solaris/SystemInfo.cpp
>  1387463 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/sys/windows/QpidDllMain.h
>  PRE-CREATION 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/sys/windows/Socket.cpp
>  1387463 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/sys/windows/SystemInfo.cpp
>  1387463 
>   
> http://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/sys/windows/Thread.cpp
>  1387463 
> 
> Diff: https://reviews.apache.org/r/7179/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Cliff Jansen
> 
>

Reply via email to