1 | // (C) Copyright Michael Glassford 2004. |
---|
2 | // Use, modification and distribution are subject to the |
---|
3 | // Boost Software License, Version 1.0. (See accompanying file |
---|
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | |
---|
6 | #if !defined(BOOST_TLS_HOOKS_HPP) |
---|
7 | #define BOOST_TLS_HOOKS_HPP |
---|
8 | |
---|
9 | #include <boost/thread/detail/config.hpp> |
---|
10 | |
---|
11 | #if defined(BOOST_HAS_WINTHREADS) |
---|
12 | |
---|
13 | typedef void (__cdecl *thread_exit_handler)(void); |
---|
14 | |
---|
15 | extern "C" BOOST_THREAD_DECL int at_thread_exit( |
---|
16 | thread_exit_handler exit_handler |
---|
17 | ); |
---|
18 | //Add a function to the list of functions that will |
---|
19 | //be called when a thread is about to exit. |
---|
20 | //Currently only implemented for Win32, but should |
---|
21 | //later be implemented for all platforms. |
---|
22 | //Used by Win32 implementation of Boost.Threads |
---|
23 | //tss to perform cleanup. |
---|
24 | //Like the C runtime library atexit() function, |
---|
25 | //which it mimics, at_thread_exit() returns |
---|
26 | //zero if successful and a nonzero |
---|
27 | //value if an error occurs. |
---|
28 | |
---|
29 | #endif //defined(BOOST_HAS_WINTHREADS) |
---|
30 | |
---|
31 | #if defined(BOOST_HAS_WINTHREADS) |
---|
32 | |
---|
33 | extern "C" BOOST_THREAD_DECL void on_process_enter(void); |
---|
34 | //Function to be called when the exe or dll |
---|
35 | //that uses Boost.Threads first starts |
---|
36 | //or is first loaded. |
---|
37 | //Should be called only before the first call to |
---|
38 | //on_thread_enter(). |
---|
39 | //Called automatically by Boost.Threads when |
---|
40 | //a method for doing so has been discovered. |
---|
41 | //May be omitted; may be called multiple times. |
---|
42 | |
---|
43 | extern "C" BOOST_THREAD_DECL void on_process_exit(void); |
---|
44 | //Function to be called when the exe or dll |
---|
45 | //that uses Boost.Threads first starts |
---|
46 | //or is first loaded. |
---|
47 | //Should be called only after the last call to |
---|
48 | //on_exit_thread(). |
---|
49 | //Called automatically by Boost.Threads when |
---|
50 | //a method for doing so has been discovered. |
---|
51 | //Must not be omitted; may be called multiple times. |
---|
52 | |
---|
53 | extern "C" BOOST_THREAD_DECL void on_thread_enter(void); |
---|
54 | //Function to be called just after a thread starts |
---|
55 | //in an exe or dll that uses Boost.Threads. |
---|
56 | //Must be called in the context of the thread |
---|
57 | //that is starting. |
---|
58 | //Called automatically by Boost.Threads when |
---|
59 | //a method for doing so has been discovered. |
---|
60 | //May be omitted; may be called multiple times. |
---|
61 | |
---|
62 | extern "C" BOOST_THREAD_DECL void on_thread_exit(void); |
---|
63 | //Function to be called just be fore a thread ends |
---|
64 | //in an exe or dll that uses Boost.Threads. |
---|
65 | //Must be called in the context of the thread |
---|
66 | //that is ending. |
---|
67 | //Called automatically by Boost.Threads when |
---|
68 | //a method for doing so has been discovered. |
---|
69 | //Must not be omitted; may be called multiple times. |
---|
70 | |
---|
71 | extern "C" void tss_cleanup_implemented(void); |
---|
72 | //Dummy function used both to detect whether tss cleanup |
---|
73 | //cleanup has been implemented and to force |
---|
74 | //it to be linked into the Boost.Threads library. |
---|
75 | |
---|
76 | #endif //defined(BOOST_HAS_WINTHREADS) |
---|
77 | |
---|
78 | #endif //!defined(BOOST_TLS_HOOKS_HPP) |
---|