]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/tls.h
remove ancient defines left over from GTK1
[wxWidgets.git] / interface / wx / tls.h
CommitLineData
64a044d5
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/tls.h
3// Purpose: wxTLS_TYPE()
4// Author: Vadim Zeitlin
526954c5 5// Licence: wxWindows licence
64a044d5
VZ
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 Macro to be used for thread-specific variables declarations.
10
11 This macro can be used to define thread-specific variables of the specified
8b73c531
VZ
12 @a type. Such variables must be global or static and must be POD, i.e.
13 not have any constructors or destructor (even implicitly generated by the
14 compiler due to use of base classes or members which are not POD in a
15 struct).
16
17 Example of use:
64a044d5
VZ
18 @code
19 struct PerThreadData
20 {
21 ... data which will be different for every thread ...
22 };
23
8b73c531
VZ
24 static wxTLS_TYPE(PerThreadData) s_threadDataVar;
25 #define s_threadData (wxTLS_VALUE(s_threadDataVar))
26
27 ... use s_threadData as a variable of type PerThreadData ...
64a044d5
VZ
28 @endcode
29
8b73c531
VZ
30 Notice that the use of the ugly wxTLS_VALUE() macro is unfortunately
31 required if you need to support platforms without native compiler support
32 for thread-specific variables. If you compile your code only on platforms
33 which do have such support (recent versions of GNU C++ compiler, Microsoft
34 Visual C++ and Sun C++ compiler are known to have it), you can avoid it and
35 use the variable directly.
36 */
37#define wxTLS_TYPE(type) compiler-dependent-implementation
38
39/**
40 Macro to access thread-specific variables.
41
42 This macro is used to hide the difference in implementation of
43 thread-specific variables under different platforms: they can be of type T
44 used in wxTLS_TYPE() if they are directly supported by the compiler or of
45 type emulating @c T @c *, i.e. a pointer to this type otherwise. This macro
46 always returns an expression of type @c T itself.
47
792255cc 48 As shown in wxTLS_TYPE() example, you may want to @c \#define a symbol
8b73c531
VZ
49 wrapping a thread-specific variable with this macro. And, as also explained
50 in wxTLS_TYPE() documentation, you may avoid using it entirely if you
51 target only recent compilers.
52
53 @see wxTLS_PTR()
64a044d5 54 */
8b73c531
VZ
55#define wxTLS_VALUE(var)
56
57/**
58 Macro to return address of a thread-specific variables.
59
60 This macro is similar to wxTLS_VALUE() except that it always returns a
61 pointer to the type of thread-specific variable.
64a044d5 62
8b73c531
VZ
63 Notice that this is not a constant expression even if the macro is defined
64 simply as @c &var -- the value returned is still different for every
65 thread.
66 */
67#define wxTLS_PTR(var)