disable the unrecognized nls flag
[AROS-Contrib.git] / regina / mt_os2.h
blob85c2aa21817be28878ebe74f2e9d4dd832a45a86
1 /* This is the supporting header file for WIN32 threads.
2 * Checked with MSVC 6.0.
3 * We need the following globals:
5 * 1) THREAD_PROTECT(varname)
6 * = a pseudo code NOT TERMINATED BY A SEMICOLON. After this point all
7 * code until a THREAD_UNPROTECT is executed by one thread at once.
8 * This may be done by a call to a semaphore action or something else.
9 * THREAD_PROTECT and THREAD_UNPROTECT define a C block logically.
10 * varname ist a variable created by PROTECTION_VAR()
11 * 2) THREAD_UNPROTECT(varname)
12 * = see above
13 * 3) PROTECTION_VAR(varname)
14 * = a pseudo code NOT TERMINATED BY A SEMICOLON. This define will
15 * create and initialize a local variable which may be used by
16 * THREAD_PROTECT and THREAD_UNPROTECT.
17 * Typical examples are the protection of static local variables.
18 * 4) GLOBAL_PROTECTION_VAR(varname)
19 * = a pseudo code NOT TERMINATED BY A SEMICOLON. This define will
20 * create and initialize a global variable which may be used by
21 * THREAD_PROTECT and THREAD_UNPROTECT.
22 * Typical examples are the usage of the parser or global variables
23 * like macro_serialno.
24 * 5) EXPORT_GLOBAL_PROTECTION_VAR(varname)
25 * = a pseudo code NOT TERMINATED BY A SEMICOLON. This define will
26 * export the varname in header files. There must exist one declaration
27 * of the variable done by GLOBAL_PROTECTION_VAR.
28 * 6) GLOBAL_ENTRY_POINT()
29 * = initializes the process specific data and the thread specific data.
30 * This pseudo function is only called by those functions which are
31 * external (rexxsaa.h).
32 * It should return (tsd_t *) of the current thread.
33 * 7) __regina_get_tsd()
34 * = pointer to a variable of type tsd_t.
35 * This may only exist after a GLOBAL_ENTRY_POINT()-call and must then
36 * exist.
40 #ifndef MT_H_INCLUDED
41 # error This file should included by mt.h, only.
42 #endif
44 /* We hide the mutex management to fasten up the compilation step. I
45 * don't want to include every special stuff here.
47 void ReginaSetMutex(void **mutex);
48 void ReginaUnsetMutex(void **mutex);
49 #define THREAD_PROTECT(varname) ReginaSetMutex(&varname); {
50 #define THREAD_UNPROTECT(varname) } ReginaUnsetMutex(&varname);
52 #define PROTECTION_VAR(varname) static void * varname = NULL;
54 #define EXPORT_GLOBAL_PROTECTION_VAR(varname) extern void *varname;
55 #define GLOBAL_PROTECTION_VAR(varname) void *varname;
57 tsd_t *ReginaInitializeThread(void);
58 #define GLOBAL_ENTRY_POINT() ReginaInitializeThread()
60 /* we need a pointer to tsd_t sometimes: */
61 tsd_t *__regina_get_tsd(void);
63 /* NEVER USE __regina_get_tsd() IF YOU CAN GET THE VALUE FROM SOMEWHERE ELSE.
64 * IT REDUCES THE EXECUTION SPEED SIGNIFICANTLY. TAKE THE VALUE FROM THE CALLER
65 * WHERE IT IS POSSIBLE.