2 * (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC.
3 * (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY
4 * (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION
5 * (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems
6 * To anyone who acknowledges that this file is provided "AS IS" without
7 * any express or implied warranty: permission to use, copy, modify, and
8 * distribute this file for any purpose is hereby granted without fee,
9 * provided that the above copyright notices and this notice appears in
10 * all source code copies, and that none of the names listed above be used
11 * in advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. None of these organizations
13 * makes any representations about the suitability of this software for
17 * Header file for CMA initialization
26 #include <dce/cma_host.h>
27 #include <cma_errors.h>
30 * CONSTANTS AND MACROS
33 #define cma__c_env_maxattr 0
34 #define cma__c_env_minattr 1
35 #define cma__c_env_maxcond 2
36 #define cma__c_env_mincond 3
37 #define cma__c_env_maxmutex 4
38 #define cma__c_env_minmutex 5
39 #define cma__c_env_maxthread 6
40 #define cma__c_env_minthread 7
41 #define cma__c_env_maxcluster 8
42 #define cma__c_env_mincluster 9
43 #define cma__c_env_maxvp 10
44 #define cma__c_env_multiplex 11
45 #define cma__c_env_trace 12
46 #define cma__c_env_trace_file 13
48 #define cma__c_env_count 13
54 * Initialize the main body of CMA exactly once.
56 * We raise an exception if, for some odd reason, there are already threads
57 * in the environment (e.g. kernel threads), and one of them is trying to
58 * initialize CMA before the first thread got all the way through the actual
59 * initialization. This code maintains the invariants: "after successfully
60 * calling CMA_INIT, you can call any CMA function", and "CMA is actually
61 * initialized at most once".
63 /*#ifndef _HP_LIBC_R */
65 #if defined _HP_LIBC_R ||(defined(SNI_SVR4) && !defined(CMA_INIT_NEEDED))
66 # define cma__int_init()
68 # define cma__int_init() { \
69 if (!cma__tac_isset(&cma__g_init_started)) { \
70 if (!cma__test_and_set (&cma__g_init_started)) { \
71 cma__init_static (); \
72 cma__test_and_set (&cma__g_init_done); \
74 else if (!cma__tac_isset (&cma__g_init_done)) { \
75 cma__error (cma_s_inialrpro); \
83 typedef enum CMA__T_ENV_TYPE
{
88 typedef struct CMA__T_ENV
{
89 char *name
; /* Name of environment variable */
90 cma__t_env_type type
; /* Type of variable */
91 cma_t_integer value
; /* Numeric value of the variable */
98 extern cma__t_env cma__g_env
[cma__c_env_count
];
99 extern cma__t_atomic_bit cma__g_init_started
;
100 extern cma__t_atomic_bit cma__g_init_done
;
101 extern char *cma__g_version
;
104 * INTERNAL INTERFACES
108 cma__init_static (void); /* Initialize static data */
110 #if _CMA_OS_ != _CMA__VMS
111 extern void cma__init_atfork (void);