[C++-sig] Any way of executing something on unload of a Boost.Python module?

Niall Douglas s_sourceforge at nedprod.com
Thu Sep 25 06:27:23 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Firstly, I'll just thank everything in here for all the help over the 
last few weeks. In fact:

>>> from TnFOX import *
Thread 0x42c (Randomness monitor) started
>>> a=FXFile("foo.txt")
>>> a.writeBlock("Niall", 5)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: Not open for writing (code 0xFFFA file 
d:\tornado\tclient\tnfox\src\fxfile.cxx line 398)
Stack backtrace:
0x00B5D0EA:<unknown>            <unknown>
                                 (file <unknown>                 line 
no 0)
0x00B5DA5F:TnFOX-0.4d7.dll      FX::operator- +0x104be
                                 (file <unknown>                 line 
no 0)
<backtrace ends>

Wow! You all might not quite appreciate how much this means to me. 
More than a month of labouring part-time and it finally all works!

The single caveat is that the randomness thread you see started above 
gets terminated when you unload the module (I'd much prefer a chance 
to shut it down nicely). I can't find anything in the docs about how 
to do this.

BTW if you're thinking "have a static variable shut it down on 
destruct" well I tried that, but unfortunately the threads on Win32 
get killed before destructing static variables. Hmm, I just thought 
of atexit()?!?

Cheers,
Niall





-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2

iQA/AwUBP3Juq8EcvDLFGKbPEQLRxgCeK379oX4MB50/mXRKa5DfpEVJcFwAoL9L
Mu6jxjYRFsB3VbqcAFSQVN8Q
=wHaC
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list