Build scalosgfx.library with actual defs.h
[AROS-Contrib.git] / regina / mt_notmt.h
bloba879379906c366009cb3b807fa456fc11d49eb49
1 /* This is a stub file to support single-threading.
2 * We need the following globals:
4 * 1) THREAD_PROTECT(varname)
5 * = a pseudo code NOT TERMINATED BY A SEMICOLON. After this point all
6 * code until a THREAD_UNPROTECT is executed by one thread at once.
7 * This may be done by a call to a semaphore action or something else.
8 * THREAD_PROTECT and THREAD_UNPROTECT define a C block logically.
9 * varname ist a variable created by PROTECTION_VAR()
10 * 2) THREAD_UNPROTECT(varname)
11 * = see above
12 * 3) PROTECTION_VAR(varname)
13 * = a pseudo code NOT TERMINATED BY A SEMICOLON. This define will
14 * create and initialize a local variable which may be used by
15 * THREAD_PROTECT and THREAD_UNPROTECT.
16 * Typical examples are the protection of static local variables.
17 * 4) GLOBAL_PROTECTION_VAR(varname)
18 * = a pseudo code NOT TERMINATED BY A SEMICOLON. This define will
19 * create and initialize a global variable which may be used by
20 * THREAD_PROTECT and THREAD_UNPROTECT.
21 * Typical examples are the usage of the parser or global variables
22 * like macro_serialno.
23 * 5) EXPORT_GLOBAL_PROTECTION_VAR(varname)
24 * = a pseudo code NOT TERMINATED BY A SEMICOLON. This define will
25 * export the varname in header files. There must exist one declaration
26 * of the variable done by GLOBAL_PROTECTION_VAR.
27 * 6) GLOBAL_ENTRY_POINT()
28 * = initializes the process specific data and the thread specific data.
29 * This pseudo function is only called by those functions which are
30 * external (rexxsaa.h).
31 * It should return (tsd_t *) of the current thread.
32 * 7) __regina_get_tsd()
33 * = pointer to a variable of type tsd_t.
34 * This may only exist after a GLOBAL_ENTRY_POINT()-call and must then
35 * exist.
39 #ifndef MT_H_INCLUDED
40 # error This file should included by mt.h, only.
41 #endif
43 #define THREAD_PROTECT(varname) {
44 #define THREAD_UNPROTECT(varname) }
45 #define PROTECTION_VAR(varname)
46 #define EXPORT_GLOBAL_PROTECTION_VAR(varname)
47 #define GLOBAL_PROTECTION_VAR(varname)
50 tsd_t *ReginaInitializeProcess(void);
51 #define GLOBAL_ENTRY_POINT() ((__regina_tsd_initialized) ? &__regina_tsd : \
52 ReginaInitializeProcess() )
54 extern tsd_t __regina_tsd;
55 extern int __regina_tsd_initialized; /* We are single-threaded -> allowed! */
57 /* we need a pointer to tsd_t sometimes: */
58 #define __regina_get_tsd() (&__regina_tsd)
60 /* NEVER USE __regina_get_tsd() IF YOU CAN GET THE VALUE FROM SOMEWHERE ELSE.
61 * IT REDUCES THE EXECUTION SPEED SIGNIFICANTLY. TAKE THE VALUE FROM THE CALLER
62 * WHERE IT IS POSSIBLE.
65 #ifdef TRACK_TSD_USAGE
66 tsd_t *__regina_WorkHeavy(void);
67 # undef __regina_get_tsd
68 # define __regina_get_tsd() __regina_WorkHeavy()
69 #endif