/* ------------------------------------------------- * GLOBAL/ROOT STATE */ KMP_ALIGN_CACHE kmp_global_t __kmp_global = {{ 0 }}; /* ----------------------------------------------- */ /* GLOBAL SYNCHRONIZATION LOCKS */ /* TODO verify the need for these locks and if they need to be global */ #if KMP_USE_INTERNODE_ALIGNMENT /* Multinode systems have larger cache line granularity which can cause * false sharing if the alignment is not large enough for these locks */ KMP_ALIGN_CACHE_INTERNODE kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock ); /* Control initializations */ KMP_ALIGN_CACHE_INTERNODE kmp_bootstrap_lock_t __kmp_forkjoin_lock; /* control fork/join access */ KMP_ALIGN_CACHE_INTERNODE kmp_bootstrap_lock_t __kmp_exit_lock; /* exit() is not always thread-safe */ #if KMP_USE_MONITOR KMP_ALIGN_CACHE_INTERNODE kmp_bootstrap_lock_t __kmp_monitor_lock; /* control monitor thread creation */ #endif KMP_ALIGN_CACHE_INTERNODE kmp_bootstrap_lock_t __kmp_tp_cached_lock; /* used for the hack to allow threadprivate cache and __kmp_threads expansion to co-exist */ KMP_ALIGN_CACHE_INTERNODE kmp_lock_t __kmp_global_lock; /* Control OS/global access */ KMP_ALIGN_CACHE_INTERNODE kmp_queuing_lock_t __kmp_dispatch_lock; /* Control dispatch access */
KMP_I18N_OPENED, // Opened successfully, ready to use. KMP_I18N_ABSENT // Opening failed, message catalog should not be used. }; // enum kmp_i18n_cat_status typedef enum kmp_i18n_cat_status kmp_i18n_cat_status_t; static volatile kmp_i18n_cat_status_t status = KMP_I18N_CLOSED; /* Message catalog is opened at first usage, so we have to synchronize opening to avoid race and multiple openings. Closing does not require synchronization, because catalog is closed very late at library shutting down, when no other threads are alive. */ static void __kmp_i18n_do_catopen(); static kmp_bootstrap_lock_t lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( lock ); // `lock' variable may be placed into __kmp_i18n_catopen function because it is used only by // that function. But we afraid a (buggy) compiler may treat it wrongly. So we put it outside of // function just in case. void __kmp_i18n_catopen( ) { if ( status == KMP_I18N_CLOSED ) { __kmp_acquire_bootstrap_lock( & lock ); if ( status == KMP_I18N_CLOSED ) { __kmp_i18n_do_catopen(); }; // if __kmp_release_bootstrap_lock( & lock ); }; // if } // func __kmp_i18n_catopen