|
Boost : |
From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2008-04-07 06:31:41
Amit <contact.lipik_at_[hidden]> writes:
> I understand that using tss with the threads library (statically linked,
> ICL 10.1 on Win32) forces the user to define tss_cleanup_implemented() in
> the global namespace.
>
> Since there is no documentation on this, I would appreciate some information as
> to whether there are any gotchas: I am assuming that tss_cleanup_implemented()
> is the place where all thread_specific_ptr's should be reset().
> Is there anything else required?
tss_cleanup_implemented() doesn't do anything itself: it is a placeholder. If
the library defines it (e.g. for MSVC on Windows, and for POSIX platforms)
then thread_specific_ptr values are automatically cleaned up on thread
exit. If the library doesn't define it, the user must define it for TSS to
work, and the user takes responsibility for ensuring that all TSS variables
are correctly cleaned up.
> Also, are there any special considerations when some of the threads might not
> have been started through Boost.threads?
This is the hardest part. For threads launched with Boost.threads, cleanup
happens anyway. It is native threads that are tricky.
> Btw, thread.hpp is extremely fiddly to use, since it does not define
> WIN32_LEAN_AND_MEAN, which leads to winsock.h getting included which makes it
> unuseable with any networking libraries (that use winsock2). I ended up
> creating my ouwn header that includes this after defning the macro.
This is a problem with the date-time headers (which are used by boost
threads). I'll see what I can do to get it fixed.
Anthony
-- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk