/* ************************************************************************* * * * Copyright 2000 Compaq Computer Corporation * * * * COMPAQ Registered in U.S. Patent and Trademark Office. * * * * Confidential computer software. Valid license from Compaq or * * authorized sublicensor required for possession, use or copying. * * Consistent with FAR 12.211 and 12.212, Commercial Computer Software, * * Computer Software Documentation, and Technical Data for Commercial * * Items are licensed to the U.S. Government under vendor's standard * * commercial license. * * * * Compaq shall not be liable for technical or editorial errors or * * omissions contained herein. The information in this document is * * subject to change without notice. * * * ************************************************************************* */ /* * @(#)$RCSfile: cma.h,v $ $Revision: 1.1.27.1 $ (DEC) $Date: 2000/10/17 21:28:08 $ */ /* * FACILITY: * * Digital's Proprietary Interface to DECthreads (cma) * * This interface is OBSOLETE. Although it will continue to be supported * in the future, no new features will be added (including 64-bit * pointer support for OpenVMS Alpha). In the future, documentation of * this interface will be moved to an "obsolete features" appendix that * may eventually be dropped from the distributed documentation set. * * New development should not use this interface. Instead, refer to the * Guide to DECthreads for information on the standard POSIX * 1003.1c-1995 interface, which uses the header file . * * In addition, it is usually relatively easy to migrate from the * proprietary cma interface to the open standard 1003.1c-1995 "pthread" * interface -- the semantics are very similar. * * ABSTRACT: * * External definitions for the OBSOLETE cma interface to the * DECthreads "core" services. * * AUTHORS: * * Dave Butenhof * * CREATION DATE: * * 2 November 1988 * * MODIFIED BY: * * Dave Butenhof * Paul Clark * Bob Conti * Paul Curtin * Steve Johnson * Brian Keane * Hans Oser * Peter Portante * Webb Scales * Ravi Chamarti * */ #ifndef CMA_INCLUDE #define CMA_INCLUDE #ifdef __cplusplus extern "C" { #endif #ifndef _DECTHREADS_ /* * Define a symbol which client code can test to determine the current * version of DECthreads. * * The DECthreads version is encoded in the numeric value of this symbol. The * version is normally in the form "Vvv.bb-ll" where "vv" represents the * major version, "bb" represents the baselevel (which increases continuously * regardless of version), and "ll" is a build level that increases in each * DECthreads project build within a baselevel. * * Higher numeric values are always more recent versions. So to check for * support of a feature that appeared in DECthreads V2.12-100, you could * check whether the symbol is > 212100. */ #define _DECTHREADS_ 315000 #endif /* * The implementation makes these basic decisions. On VMS, save and adjust * the extern_model (standard for VAXC) prior to including cma_config.h. */ #if defined (vms) || defined (__vms) || defined (VMS) || defined (__VMS) || defined (__vms__) # if defined (__decc) || defined (__DECC) || (defined (__cplusplus) && defined (__DECCXX)) # pragma __extern_model __save # pragma __extern_model __strict_refdef # elif defined (vaxc) || defined (VAXC) || defined (__vaxc) || defined (__VAXC) # pragma nostandard # endif # include /* configuration symbols */ # include #else # include # include #endif #if _CMA_OSIMPL_ == _CMA__OS_OSF /* * The Digital UNIX standards.h defines POSIX and OSF programming environment * symbols if none of the recognized symbols are already defined, but defines * no more if any are already defined. To retain as much as possible of the * application's desired environment, we'll include unistd.h first to get * whatever it thinks we need -- and then define what we really do need if it * didn't. */ # include # include #endif #if _CMA_OS_ == _CMA__UNIX # include # include #endif #if _CMA_PLATFORM_ == _CMA__ALPHA_VMS # include #endif /* * Enable reentrant errno.h */ #if (_CMA_OSIMPL_ == _CMA__OS_OSF) && _CMA_REENTRANT_CLIB_ # ifndef _REENTRANT # define _REENTRANT 1 # endif #endif /* * Basic types */ typedef long cma_t_integer; typedef unsigned long cma_t_natural; typedef cma_t_natural cma_t_boolean; typedef float cma_t_interval; typedef int cma_t_errno; #if _CMA_VOID_ typedef void *cma_t_address; #else typedef char *cma_t_address; #endif #define cma_c_false (cma_t_boolean)0 #define cma_c_true (cma_t_boolean)1 #define cma_c_null_ptr (cma_t_address)0 /* * If we're on a system with POSIX 1003.4 support, use the system symbols for * scheduling policy. */ #if _CMA_RT4_KTHREAD_ # define cma_c_sched_fifo SCHED_FIFO # define cma_c_sched_rr SCHED_RR # define cma_c_sched_throughput SCHED_FG_NP # define cma_c_sched_background SCHED_BG_NP # define cma_c_sched_ada_low SCHED_LFI_NP # define cma_c_sched_ada_rtb SCHED_LRR_NP /* * NOTE: * * On Digital UNIX, this header file retains the binary value of cma priority * symbols used prior to Digital UNIX 4.0. However, on earlier versions the * cma priorities mapped directly to kernel realtime priorities. In the new * version of DECthreads, all cma threads are "multiplexed" onto arbitrary * kernel threads in user mode, and cma priority has no real relationship to * the kernel priority at which the thread runs -- it controls only which * user thread the DECthreads core will select to run when a kernel thread * becomes available. */ # define cma_c_prio_fifo_max 21 # define cma_c_prio_fifo_mid 18 # define cma_c_prio_fifo_min 14 # define cma_c_prio_rr_max 22 # define cma_c_prio_rr_mid 19 # define cma_c_prio_rr_min 15 # define cma_c_prio_through_max 22 # define cma_c_prio_through_mid 19 # define cma_c_prio_through_min 15 # define cma_c_prio_back_max 13 # define cma_c_prio_back_mid 8 # define cma_c_prio_back_min 0 # define cma_c_prio_ada_low_max 13 # define cma_c_prio_ada_low_mid 8 # define cma_c_prio_ada_low_min 0 # define cma_c_prio_ada_rtb_max 13 # define cma_c_prio_ada_rtb_mid 8 # define cma_c_prio_ada_rtb_min 0 #else # define cma_c_sched_fifo 0 # define cma_c_sched_rr 1 # define cma_c_sched_throughput 2 # define cma_c_sched_background 3 # define cma_c_sched_ada_low 4 # define cma_c_sched_ada_rtb 5 # define cma_c_prio_fifo_max 31 # define cma_c_prio_fifo_mid ((31+16)/2) # define cma_c_prio_fifo_min 16 # define cma_c_prio_rr_max cma_c_prio_fifo_max # define cma_c_prio_rr_mid cma_c_prio_fifo_mid # define cma_c_prio_rr_min cma_c_prio_fifo_min # define cma_c_prio_through_max 15 # define cma_c_prio_through_mid ((15+8)/2) # define cma_c_prio_through_min 8 # define cma_c_prio_back_max 7 # define cma_c_prio_back_mid ((7+0)/2) # define cma_c_prio_back_min 0 # define cma_c_prio_ada_low_max cma_c_prio_back_max # define cma_c_prio_ada_low_mid cma_c_prio_back_mid # define cma_c_prio_ada_low_min cma_c_prio_back_min # define cma_c_prio_ada_rtb_max cma_c_prio_ada_low_max # define cma_c_prio_ada_rtb_mid cma_c_prio_ada_low_mid # define cma_c_prio_ada_rtb_min cma_c_prio_ada_low_min #endif #define cma_c_sched_default cma_c_sched_throughput #define cma_c_sched_other cma_c_sched_default /* * Contention scope possible values */ #if _CMA_OS_ == _CMA__UNIX #define cma_c_scope_process 0 #define cma_c_scope_system 1 #endif /* * The implementation of the cma_t_date_time type should match the "native * time" of the platform: that allows clients to use the full set of platform * time operations, rather than just "cma_get_expiration", to compute and * test timed waits. * * This section assumes the platform is either "VMS" or "UNIX-ish". Others * will require changes. */ #if _CMA_OS_ == _CMA__VMS typedef struct CMA_T_DATE_TIME { unsigned long int low; unsigned long int high; } cma_t_date_time; #else typedef struct timeval cma_t_date_time; #endif /* * Handle type */ typedef struct CMA_T_HANDLE { cma_t_natural field1; cma_t_natural field2; } cma_t_handle; #if (_CMA_COMPILER_ == _CMA__CFRONT) && (_CMA_OS_ == _CMA__VMS) /* * The following declaration is a hack to support CFRONT (C++ preprocessor); * without an actual instance, the struct definition isn't written out. * Creates problems for VAX C when it compiles CFRONT output. */ static struct CMA_T_HANDLE cxxl_unused_handle; #endif #define cma_c_handle_size sizeof(cma_t_handle) /* * Predefined null handle */ #ifndef _CMA_SUPPRESS_EXTERNALS_ _CMA_IMPORT_ cma_t_handle cma_c_null; #endif /* * One-time initialization control block and its initialization macro. * * Declare a one time initialization control block as: * * static cma_t_once block = cma_once_init; */ typedef struct CMA_T_ONCE { cma_t_integer field1; cma_t_integer field2; cma_t_integer field3; } cma_t_once; #define cma_once_init {0, 0, 0} /* * Alert state structure */ typedef struct CMA_T_ALERT_STATE { cma_t_integer state1; cma_t_integer state2; } cma_t_alert_state; /* * Operations on Handles */ extern void _CMA_CALL_ cma_handle_assign ( /* Assign one handle to another */ cma_t_handle *handle1, /* Input handle */ cma_t_handle *handle2); /* Output handle */ extern cma_t_boolean _CMA_CALL_ cma_handle_equal ( /* Compare two handles */ cma_t_handle *handle1, cma_t_handle *handle2); /* * Operations on attributes objects */ typedef cma_t_handle cma_t_attr; /* * An attributes object is created to specify the attributes of other CMA * objects that will be created. */ extern void _CMA_CALL_ cma_attr_create ( cma_t_attr *new_attr, cma_t_attr *attr); /* * An attributes object can be deleted when it is no longer needed. */ extern void _CMA_CALL_ cma_attr_delete ( cma_t_attr *attr); /* * Operations on threads */ typedef cma_t_handle cma_t_thread; typedef cma_t_address (*cma_t_start_routine) (cma_t_address arg); typedef enum CMA_T_EXIT_STATUS { cma_c_term_error = 0, cma_c_term_normal = 1, cma_c_term_alert = 2 } cma_t_exit_status; typedef enum CMA_T_SCHED_INHERIT { cma_c_sched_inherit = 0, cma_c_sched_use_default = 1 } cma_t_sched_inherit; typedef enum CMA_T_DETACH_STATE { cma_c_create_joinable = 0, cma_c_create_detached = 1 } cma_t_detach_state; /* * The following procedures can be used to control thread creation, * termination and deletion. */ /* * To create a thread object and runnable thread, a routine must be specified * as the new thread's start routine. An argument may be passed to this * routine, as an untyped address; an untyped address may also be returned as * the routine's value. An attributes object may be used to specify details * about the kind of thread being created. */ extern void _CMA_CALL_ cma_thread_create ( cma_t_thread *new_thread, cma_t_attr *attr, cma_t_start_routine start_routine, cma_t_address arg); /* * A thread object may be "detached" to specify that the return value and * completion status will not be requested. */ extern void _CMA_CALL_ cma_thread_detach ( cma_t_thread *thread); /* * A thread may terminate it's own execution. */ extern void _CMA_CALL_ cma_thread_exit_error (void); extern void _CMA_CALL_ cma_thread_exit_normal ( cma_t_address result); /* * A thread can await termination of another thread and retrieve the return * value and completion status of the thread. */ extern void _CMA_CALL_ cma_thread_join ( cma_t_thread *thread, cma_t_exit_status *exit_status, cma_t_address *result); /* * Operations to define thread creation attributes */ typedef cma_t_integer cma_t_priority; typedef cma_t_integer cma_t_sched_policy; #if _CMA_OS_ == _CMA__UNIX typedef cma_t_integer cma_t_scope; #endif /* * Set or obtain the default thread priority. */ extern void _CMA_CALL_ cma_attr_set_priority ( cma_t_attr *attr, cma_t_priority pri); extern void _CMA_CALL_ cma_attr_get_priority ( cma_t_attr *attr, cma_t_priority *pri); /* * Set or obtain the default scheduling algorithm */ extern void _CMA_CALL_ cma_attr_set_sched ( cma_t_attr *attr, cma_t_sched_policy policy, cma_t_priority priority); extern void _CMA_CALL_ cma_attr_get_sched ( cma_t_attr *attr, cma_t_sched_policy *policy); /* * Set or obtain whether a thread will use the scheduling attributes set in * the attributes object or inherit them from the creating thread. Note, * inheritance is the default. */ extern void _CMA_CALL_ cma_attr_set_inherit_sched ( cma_t_attr *attr, cma_t_sched_inherit setting); extern void _CMA_CALL_ cma_attr_get_inherit_sched ( cma_t_attr *attr, cma_t_sched_inherit *setting); /* * Set or obtain the default stack size */ extern void _CMA_CALL_ cma_attr_set_stacksize ( cma_t_attr *attr, cma_t_natural stacksize); extern void _CMA_CALL_ cma_attr_get_stacksize ( cma_t_attr *attr, cma_t_natural *stacksize); /* * Set or obtain the default guard size */ extern void _CMA_CALL_ cma_attr_set_guardsize ( cma_t_attr *attr, cma_t_natural guardsize); extern void _CMA_CALL_ cma_attr_get_guardsize ( cma_t_attr *attr, cma_t_natural *guardsize); /* * Set or obtain the default contention scope */ #if _CMA_OS_ == _CMA__UNIX extern void _CMA_CALL_ cma_attr_set_scope ( cma_t_attr *attr, cma_t_scope scope); extern void _CMA_CALL_ cma_attr_get_scope ( cma_t_attr *attr, cma_t_scope *scope); #endif /* * Set or obtain the create-already-detached attribute */ extern void _CMA_CALL_ cma_attr_get_detachstate ( cma_t_attr *att, cma_t_detach_state *setting); extern void _CMA_CALL_ cma_attr_set_detachstate ( cma_t_attr *att, cma_t_detach_state setting); /* * Thread Scheduling Operations */ /* * Set or obtain the priority of a thread. */ extern void _CMA_CALL_ cma_thread_get_priority ( cma_t_thread *thread, cma_t_priority *priority); extern void _CMA_CALL_ cma_thread_set_priority ( cma_t_thread *thread, cma_t_priority priority); /* * Set or obtain the scheduling algorithm of a thread. */ extern void _CMA_CALL_ cma_thread_get_sched ( cma_t_thread *thread, cma_t_sched_policy *policy); extern void _CMA_CALL_ cma_thread_set_sched ( cma_t_thread *thread, cma_t_sched_policy policy, cma_t_priority priority); /* * A thread may tell the scheduler that its processor can be made available. */ extern void _CMA_CALL_ cma_yield (void); /* * A thread may enter a wait state for a specified period of time. */ extern void _CMA_CALL_ cma_delay ( cma_t_interval interval); /* * Bind a thread to a particular CPU on a multiprocessor system. */ extern void _CMA_CALL_ cma_thread_bind_to_cpu ( cma_t_thread *thread, long cpu_mask); /* * Thread Information Operations */ /* * A thread may obtain a copy of its own thread handle. */ extern void _CMA_CALL_ cma_thread_get_self ( cma_t_thread *thread); /* * Get the sequence number of a thread. */ extern cma_t_natural _CMA_CALL_ cma_thread_get_unique ( cma_t_thread *thread); /* * Operations on Mutexes */ typedef cma_t_handle cma_t_mutex; typedef enum CMA_T_MUTEX_KIND { cma_c_mutex_fast = 0, cma_c_mutex_recursive = 1, cma_c_mutex_nonrecursive = 2 } cma_t_mutex_kind; /* * Operations to define mutex creation attributes */ /* * Set or obtain whether mutex locks can nest. */ extern void _CMA_CALL_ cma_attr_set_mutex_kind ( cma_t_attr *attr, cma_t_mutex_kind nest); extern void _CMA_CALL_ cma_attr_get_mutex_kind ( cma_t_attr *attr, cma_t_mutex_kind *nest); /* * A thread can create and delete mutexes. */ extern void _CMA_CALL_ cma_mutex_create ( cma_t_mutex *new_mutex, cma_t_attr *attr); extern void _CMA_CALL_ cma_mutex_delete ( cma_t_mutex *mutex); /* * A thread can lock or unlock a mutex. */ extern void _CMA_CALL_ cma_mutex_lock ( cma_t_mutex *mutex); extern cma_t_boolean _CMA_CALL_ cma_mutex_try_lock ( cma_t_mutex *mutex); extern void _CMA_CALL_ cma_mutex_unlock ( cma_t_mutex *mutex); /* * A thread may synchronize access to external non-thread-safe code or data, * preventing conflict with threads created by other facilities, by using the * DECthreads "Global Lock". */ extern void _CMA_CALL_ cma_lock_global (void); extern void _CMA_CALL_ cma_unlock_global (void); /* * Operations on condition variables */ typedef cma_t_handle cma_t_cond; /* * A thread can create and delete condition variables. */ extern void _CMA_CALL_ cma_cond_create ( cma_t_cond *new_condition, cma_t_attr *attr); extern void _CMA_CALL_ cma_cond_delete ( cma_t_cond *condition); /* * A thread can signal to and broadcast on a condition variable. */ extern void _CMA_CALL_ cma_cond_broadcast ( cma_t_cond *condition); extern void _CMA_CALL_ cma_cond_signal ( cma_t_cond *condition); extern void _CMA_CALL_ cma_cond_signal_int ( cma_t_cond *condition); extern void _CMA_CALL_ cma_cond_signal_preempt_int ( #if _CMA_OS_ == _CMA__UNIX cma_t_cond *condition, cma_t_address scp #else cma_t_cond *condition #endif ); /* * A thread can wait for a condition variable to be signalled or broadcast. */ extern void _CMA_CALL_ cma_cond_wait ( cma_t_cond *condition, cma_t_mutex *mutex); /* * Operations for timed waiting */ typedef cma_t_integer cma_t_status; /* * A thread can perform a timed wait on a condition variable. */ extern cma_t_status _CMA_CALL_ cma_cond_timed_wait ( cma_t_cond *condition, cma_t_mutex *mutex, cma_t_date_time *expiration); /* * A thread may perform some operations on absolute date-time and intervals. */ extern void _CMA_CALL_ cma_time_get_expiration ( cma_t_date_time *expiration, cma_t_interval interval); /* * Operations for DECthreads and client initialization. */ /* * Initialize the DECthreads facility. (Use of this routine is not required * on OpenVMS, Digital UNIX or Windows NT.) */ extern void _CMA_CALL_ cma_init (void); /* * A thread can declare a one-time initialization routine. The address of * the init block and routine are passed as parameters. */ typedef void (*cma_t_init_routine) (cma_t_address arg); extern void _CMA_CALL_ cma_once ( cma_t_once *init_block, cma_t_init_routine init_routine, cma_t_address arg); /* * Operations for per-thread context */ typedef cma_t_natural cma_t_key; typedef void (*cma_t_destructor) (cma_t_address ctx_value); /* * A unique per-thread context key can be obtained for the process */ extern void _CMA_CALL_ cma_key_create ( cma_t_key *key, cma_t_attr *attr, cma_t_destructor destructor); /* * A thread can set a per-thread context value identified by a key. */ extern void _CMA_CALL_ cma_key_set_context ( cma_t_key key, cma_t_address context_value); /* * A thread can retrieve a per-thread context value identified by a key. */ extern void _CMA_CALL_ cma_key_get_context ( cma_t_key key, cma_t_address *context_value); /* * Operations for alerts. */ /* * The current thread can request that a thread terminate. */ extern void _CMA_CALL_ cma_thread_alert ( cma_t_thread *thread); /* * The current thread can poll for alert delivery. */ extern void _CMA_CALL_ cma_alert_test (void); /* * The current thread can disable asynchronous alert delivery, restore the * previous state of asynchronous alert delivery, or enable asynchronous * alert delivery. */ extern void _CMA_CALL_ cma_alert_disable_asynch ( cma_t_alert_state *prior); extern void _CMA_CALL_ cma_alert_disable_general ( cma_t_alert_state *prior); extern void _CMA_CALL_ cma_alert_enable_asynch (void); extern void _CMA_CALL_ cma_alert_enable_general ( cma_t_alert_state *prior); extern void _CMA_CALL_ cma_alert_restore ( cma_t_alert_state *prior); /* * A thread may check to see if there is sufficient space on its current stack */ extern cma_t_boolean _CMA_CALL_ cma_stack_check_limit_np ( cma_t_integer size); /* * Debug threads */ extern void _CMA_CALL_ cma_debug (void); /* * The cma_debug_cmd() function returns the status of the last specified * operation in the command string. */ typedef enum CMA_T_DBG_STATUS { cma_s_dbg_success = 0, /* Command was successful */ cma_s_dbg_quit = 1, /* Last command was 'quit' or 'exit' */ cma_s_dbg_nonesel = 2, /* No objects selected (e.g., "thread -br") */ cma_s_dbg_successpend = 3, /* Alternate success */ cma_s_dbg_nopriv = -1, /* No privilege for command */ cma_s_dbg_invparam = -2, /* Invalid parameter on command */ cma_s_dbg_invseq = -3, /* Invalid object sequence number given */ cma_s_dbg_inconstate = -4, /* Inconsistent state for operation */ cma_s_dbg_corrupt = -5, /* Unable to complete; internal corruption */ cma_s_dbg_invoption = -6, /* Invalid command options */ cma_s_dbg_noarg = -7, /* Missing command argument */ cma_s_dbg_invaddr = -8, /* Invalid address */ cma_s_dbg_invcmd = -9, /* Invalid command */ cma_s_dbg_nullcmd = -10, /* No command given */ cma_s_dbg_conflict = -11, /* Conflicting options */ cma_s_dbg_unimpl = -12 /* Unimplemented feature */ } cma_t_dbg_status; /* * Pass a command string to DECthreads debug for interpretation. The * argument is a "char *" command string. */ extern cma_t_dbg_status _CMA_CALL_ cma_debug_cmd (char *cmd); /* * Restore extern_model or standard environment, adjusted prior to * inclusion of cma_config.h. */ #if _CMA_OS_ == _CMA__VMS # if ((_CMA_COMPILER_ == _CMA__DECC) || (_CMA_COMPILER_ == _CMA__DECCPLUS)) # pragma __extern_model __restore # elif _CMA_COMPILER_ == _CMA__VAXC # pragma standard # endif #endif #ifdef __cplusplus } #endif #endif /********************************************************************************************************************************/ /* Created 2-MAR-1994 10:03:17 by VAX SDL V3.2-12 Source: 2-MAR-1994 10:03:08 CMAPRIVATE_ROOT:[WORK.CORE.VMS]CMA$DEF.SDL;7 */ /********************************************************************************************************************************/ /*** MODULE CMA$DEF IDENT V1.10-031 ***/ /* */ /* Copyright 2000 Compaq Computer Corporation */ /* */ /* Compaq and the Compaq logo Registered in U.S. Patent and Trademark */ /* Office. */ /* */ /* Confidential computer software. Valid license from Compaq required */ /* for possession, use or copying. Consistent with FAR 12.211 and 12.212, */ /* Commercial Computer Software, Computer Software Documentation, and */ /* Technical Data for Commercial Items are licensed to the U.S. Government */ /* under vendor's standard commercial license. */ /* */ /* */ /* FACILITY: */ /* */ /* Common Multithread Architecture (CMA) services */ /* */ /* ABSTRACT: */ /* */ /* External definitions for CMA services */ /* */ /* AUTHORS: */ /* */ /* Dave Butenhof (-Original) */ /* Paul Curtin (-Generic/SDL) */ /* */ /* CREATION DATE: */ /* */ /* 2 November 1988 (-Original) */ /* 7 September 1990 (-Generic/SDL) */ /* */ /* MODIFIED BY: */ /* */ /* Dave Butenhof */ /* Paul Curtin */ /* Gerald Feldman */ /* Webb Scales */ /* */ #ifndef CMA_DEF_INCLUDE #define CMA_DEF_INCLUDE #pragma __nostandard #ifdef __cplusplus extern "C" { #endif /* */ /* Define a symbol which client code can test to determine whether the */ /* underlying threads package is DECthreads or not. This is especially */ /* important to clients of the Pthreads interface who may want to use */ /* certain DECthreads extensions, such as the global lock and non-real-time */ /* scheduling policies, on the DECthreads platform while maintaining */ /* portability to a "vanilla" pthreads implementation. */ /* */ #define _DECTHREADS_ 1 #if defined(vms) || defined(__vms) || defined (VMS) || defined(__VMS) || defined(__vms__) # if defined (__decc) || defined (__DECC) || (defined (__cplusplus) && defined (__DECCXX)) # pragma __extern_model __save # pragma __extern_model __strict_refdef # endif # include /* configuration symbols */ #else # include /* configuration symbols */ #endif /* * The implementation makes these basic decisions */ #if _CMA_OS_ != _CMA__VMS # include # include #endif /* * For the VMS cma$ interface, suppress the EXC_ exceptions */ #if !defined(_EXC_NO_EXCEPTIONS_) #define _EXC_NO_EXCEPTIONS_ #endif #if _CMA_OS_ == _CMA__VMS # include /* Bring in exception services */ #else # include /* Bring in exception services */ #endif #if (_CMA_OSIMPL_ == _CMA__OS_OSF) && _CMA_REENTRANT_CLIB_ # define _REENTRANT 1 /* Enable reentrant errno.h */ #endif #ifdef _CMA_PROTO_ # define _CMA_PROTOTYPE_(arg) arg #else # define _CMA_PROTOTYPE_(arg) () #endif typedef long int cma$t_integer; typedef unsigned long int cma$t_boolean; typedef unsigned long int cma$t_natural; typedef float cma$t_interval; typedef long int cma$t_key; typedef long int cma$t_status; typedef long int cma$t_priority; #if _CMA_VOID_ typedef void *cma$t_address; #else typedef char *cma$t_address; #endif #define cma$c_prio_fifo_min 16 #define cma$c_prio_fifo_mid 24 #define cma$c_prio_fifo_max 31 #define cma$c_prio_rr_min 16 #define cma$c_prio_rr_mid 24 #define cma$c_prio_rr_max 31 #define cma$c_prio_through_min 8 #define cma$c_prio_through_mid 12 #define cma$c_prio_through_max 15 #define cma$c_prio_back_min 0 #define cma$c_prio_back_mid 4 #define cma$c_prio_back_max 7 #define cma$c_prio_ada_low_min 0 #define cma$c_prio_ada_low_mid 4 #define cma$c_prio_ada_low_max 7 #define cma$c_prio_ada_rtb_min 0 #define cma$c_prio_ada_rtb_mid 4 #define cma$c_prio_ada_rtb_max 7 /* */ /* The implementation of the date_time type should match the "native */ /* time" of the platform: that allows clients to use the full set of platform */ /* time operations, rather than just "get_expiration", to compute and */ /* test timed waits. */ /* */ /* This section assumes the platform is either "VMS" or "UNIX-ish". Others */ /* will require changes. */ /* */ #if _CMA_OS_ == _CMA__VMS typedef struct _cma$t_date_time { unsigned long int low; unsigned long int high; } cma$t_date_time; #else typedef struct timeval cma$t_date_time; #endif /* */ /* Sample decisions for what handles shall be */ /* */ typedef struct _cma$t_handle { cma$t_address handle_field1; short int handle_field2; short int handle_field3; } cma$t_handle; #define cma$c_handle_size 8 #if (_CMA_COMPILER_ == _CMA__CFRONT) && (_CMA_OS_ == _CMA__VMS) /* * The following declaration is a hack to support CFRONT (C++ preprocessor); * without an actual instance, the struct definition isn't written out. * Creates problems for VAX C when it compiles CFRONT output. */ static struct CMA_T_HANDLE cxxl_unused_handle; #endif #define cma$thread_get_unique(handle) \ (((unsigned int)((cma$t_thread *)handle)->handle_field2)) /* */ /* Sample decision for a one-time initialization control block and its */ /* initialization macro. */ /* */ /* */ typedef struct _cma$t_once { cma$t_integer once_field1; cma$t_integer once_field2; cma$t_integer once_field3; } cma$t_once; /* */ /* Sample decision for a variable to save the current alert state. */ /* */ typedef struct _cma$t_alert_state { cma$t_integer state1; cma$t_integer state2; } cma$t_alert_state; /* */ /* The following are the portable CMA definitions */ /* */ /* */ /* Operations on threads */ /* */ typedef cma$t_address (*cma$t_start_routine)(); /* */ /* Constants */ /* */ #define cma$c_false 0 #define cma$c_true 1 #define cma$c_null_ptr 0 /* */ /* Objects */ /* */ typedef cma$t_handle cma$t_mutex; /* Needed for ONCE_BLOCK */ typedef cma$t_handle cma$t_attr; typedef cma$t_handle cma$t_thread; typedef cma$t_handle cma$t_cond; typedef cma$t_handle cma$t_stack_np; /* */ /* Predefined null handle */ /* */ _CMA_IMPORT_ cma$t_handle cma$c_null; /* * Declare a one time initialization control block. * * static cma$t_once block = cma$once_init; */ #define cma$once_init {0, 0, 0} /* * Exit status constants */ typedef enum _CMA$T_EXIT_STATUS { cma$c_null_thread = -1, cma$c_term_error = 0, cma$c_term_normal = 1, cma$c_term_alert = 2 } cma$t_exit_status; /* * Schedule inheritance constants */ typedef enum _CMA$T_SCHED_INHERIT { cma$c_sched_inherit = 0, cma$c_sched_use_default = 1 } cma$t_sched_inherit; /* * Schedule policy constants */ typedef enum _CMA$T_SCHED_POLICY { cma$c_sched_fifo = 0, cma$c_sched_rr = 1, cma$c_sched_throughput = 2, cma$c_sched_background = 3, cma$c_sched_ada_low = 4, cma$c_sched_idle = 5 } cma$t_sched_policy; /* * cma$c_sched_default and cma$c_sched_other definitions */ #define cma$c_sched_default cma$c_sched_throughput #define cma$c_sched_other cma$c_sched_default /* * Mutex types */ typedef enum _CMA$T_MUTEX_KIND { cma$c_mutex_fast = 0, cma$c_mutex_recursive = 1, cma$c_mutex_nonrecursive = 2 } cma$t_mutex_kind; /* */ /* Sample decision for error codes */ /* */ /* Values used are "VMS status codes" in decimal. These */ /* must remain in synch with the "message file" MESSAGE_VMS.MSG */ /* Note: these values cannot be altered after they have shipped in */ /* some CMA release. Octal boundaries are shown on the decimal */ /* values. GAF 6/1/92 Coordinated definitions with exc_handling.h */ /* */ #define cma$_exception 4227084 #define cma$_exccop 4227092 #define cma$_uninitexc 4227100 #define cma$_unkstatus 4228100 #define cma$_exccoplos 4228108 #define cma$_illaddr 12 #define cma$_exquota 28 #define cma$_insfmem 292 #define cma$_nopriv 36 #define cma$_normal 1 #define cma$_illinstr 1084 #define cma$_resaddr 1100 #define cma$_privinst 1084 #define cma$_resoper 1108 #define cma$_SIGTRAP 1044 #define cma$_SIGIOT 44 #define cma$_SIGEMT 1068 #define cma$_aritherr 1164 #define cma$_SIGSYS 20 #define cma$_SIGPIPE 628 #define cma$_excpu 8364 #define cma$_exfilsiz 1004 #define cma$_intovf 1148 #define cma$_intdiv 1156 #define cma$_fltovf 1164 #define cma$_fltdiv 1172 #define cma$_fltund 1180 #define cma$_decovf 1188 #define cma$_subrng 1196 #define cma$_accvio 12 #define cma$_SIGILL 1084 #define cma$_SIGFPE 1164 #define cma$_SIGBUS 1084 #define cma$_SIGSEGV 1084 #define cma$_SIGXCPU 8364 #define cma$_SIGXFSZ 1004 #define cma$_alerted 4227460 #define cma$_assertion 4227468 #define cma$_badparam 4227476 #define cma$_bugcheck 4227484 #define cma$_exit_thread 4227492 #define cma$_existence 4227500 #define cma$_in_use 4227508 #define cma$_use_error 4227516 #define cma$_wrongmutex 4227524 #define cma$_stackovf 4227532 #define cma$_nostackmem 4227540 #define cma$_notcmastack 4227548 #define cma$_timed_out 4227556 #define cma$_unimp 4227564 #define cma$_inialrpro 4227572 #define cma$_defer_q_full 4227580 #define cma$_signal_q_full 4227588 #define cma$_alert_nesting 4227596 /* */ /* EXCEPTION TYPE DEFINITIONS */ /* */ typedef char *cma$exc_address_t; typedef long int cma$exc_kind_t; typedef long int cma$exc_int_t; /* */ /* Internal contents of an exception object. */ /* */ typedef struct _cma$t_exception { cma$exc_kind_t exc_kind; cma$exc_address_t exc_info; cma$exc_address_t exc_filler [6]; } cma$t_exception; _CMA_IMPORT_ cma$t_exception cma$e_uninitexc; _CMA_IMPORT_ cma$t_exception cma$e_illaddr; _CMA_IMPORT_ cma$t_exception cma$e_exquota; _CMA_IMPORT_ cma$t_exception cma$e_insfmem; _CMA_IMPORT_ cma$t_exception cma$e_nopriv; _CMA_IMPORT_ cma$t_exception cma$e_illinstr; _CMA_IMPORT_ cma$t_exception cma$e_resaddr; _CMA_IMPORT_ cma$t_exception cma$e_privinst; _CMA_IMPORT_ cma$t_exception cma$e_resoper; _CMA_IMPORT_ cma$t_exception cma$e_SIGTRAP; _CMA_IMPORT_ cma$t_exception cma$e_SIGIOT; _CMA_IMPORT_ cma$t_exception cma$e_SIGEMT; _CMA_IMPORT_ cma$t_exception cma$e_aritherr; _CMA_IMPORT_ cma$t_exception cma$e_SIGSYS; _CMA_IMPORT_ cma$t_exception cma$e_SIGPIPE; _CMA_IMPORT_ cma$t_exception cma$e_excpu; _CMA_IMPORT_ cma$t_exception cma$e_exfilsiz; _CMA_IMPORT_ cma$t_exception cma$e_intovf; _CMA_IMPORT_ cma$t_exception cma$e_intdiv; _CMA_IMPORT_ cma$t_exception cma$e_fltovf; _CMA_IMPORT_ cma$t_exception cma$e_fltdiv; _CMA_IMPORT_ cma$t_exception cma$e_fltund; _CMA_IMPORT_ cma$t_exception cma$e_decovf; _CMA_IMPORT_ cma$t_exception cma$e_subrng; _CMA_IMPORT_ cma$t_exception cma$e_alerted; _CMA_IMPORT_ cma$t_exception cma$e_assertion; _CMA_IMPORT_ cma$t_exception cma$e_badparam; _CMA_IMPORT_ cma$t_exception cma$e_bugcheck; _CMA_IMPORT_ cma$t_exception cma$e_exit_thread; _CMA_IMPORT_ cma$t_exception cma$e_existence; _CMA_IMPORT_ cma$t_exception cma$e_in_use; _CMA_IMPORT_ cma$t_exception cma$e_use_error; _CMA_IMPORT_ cma$t_exception cma$e_wrongmutex; _CMA_IMPORT_ cma$t_exception cma$e_stackovf; _CMA_IMPORT_ cma$t_exception cma$e_nostackmem; _CMA_IMPORT_ cma$t_exception cma$e_notcmastack; _CMA_IMPORT_ cma$t_exception cma$e_unimp; _CMA_IMPORT_ cma$t_exception cma$e_inialrpro; _CMA_IMPORT_ cma$t_exception cma$e_defer_q_full; _CMA_IMPORT_ cma$t_exception cma$e_signal_q_full; _CMA_IMPORT_ cma$t_exception cma$e_alert_nesting; /* */ /* Operations on Handles */ /* */ /* */ /* The value of a handle can be assigned the value of another handle. */ /* */ void cma$handle_assign() ; /* */ /* The value of a handle can be assigned the value of another handle. */ /* */ cma$t_boolean cma$handle_equal() ; /* */ /* An attributes object is created to specify the attributes of other CMA */ /* objects that will be created. */ /* */ void cma$attr_create() ; /* */ /* An attributes object can be deleted when it is no longer needed. */ /* */ void cma$attr_delete() ; /* */ /* The following procedures can be used to control thread creation, */ /* termination and deletion. */ /* */ /* */ /* To create a thread object and runnable thread, a routine must be specified */ /* as the new thread's start routine. An argument may be passed to this */ /* routine, as an untyped address; an untyped address may also be returned as */ /* the routine's value. An attributes object may be used to specify details */ /* about the kind of thread being created. */ /* */ void cma$thread_create() ; /* */ /* A thread object may be "detached" to specify that the return value and */ /* completion status will not be requested. */ /* */ void cma$thread_detach() ; /* */ /* A thread may terminate it's own execution. */ /* */ void cma$thread_exit_error() ; /* */ /* Exit a thread normally. */ /* */ void cma$thread_exit_normal() ; /* */ /* A thread can await termination of another thread and retrieve the return */ /* value and completion status of the thread. */ /* */ void cma$thread_join() ; /* */ /* Operations to define thread creation attributes */ /* */ /* */ /* Set or obtain the default thread priority. */ /* */ void cma$attr_set_priority() ; /* */ /* Obtain thread priority from attributes object. */ /* */ void cma$attr_get_priority() ; /* */ /* Set or obtain the default scheduling algorithm. */ /* */ void cma$attr_set_sched() ; /* */ /* Get thread scheduling algorithm from attributes object. */ /* */ void cma$attr_get_sched() ; /* */ /* Set or obtain whether a thread will use the default scheduling attributes, */ /* or inherit them from the creating thread. */ /* */ void cma$attr_set_inherit_sched() ; /* */ /* Obtain default scheduling attributes. */ /* */ void cma$attr_get_inherit_sched() ; /* */ /* Set the default stack size */ /* */ void cma$attr_set_stacksize() ; /* */ /* Obtain the default stack size. */ /* */ void cma$attr_get_stacksize() ; /* */ /* Set the default guard size */ /* */ void cma$attr_set_guardsize() ; /* */ /* Obtain the default guard size */ /* */ void cma$attr_get_guardsize() ; /* */ /* Thread Scheduling Operations */ /* */ /* */ /* The current user_assigned priority of a thread can be changed. */ /* */ void cma$thread_set_priority() ; /* */ /* The current user_assigned scheduler algorithm of a thread can be changed. */ /* */ void cma$thread_set_sched() ; /* */ /* A thread may tell the scheduler that its processor can be made available. */ /* */ void cma$yield() ; /* */ /* A thread may enter a wait state for a specifed period of time. */ /* */ void cma$delay() ; /* */ /* Thread Information Operations */ /* */ /* */ /* A thread may obtain a copy of its own thread handle. */ /* */ void cma$thread_get_self() ; /* */ /* The current user_assigned priority of a thread can be read. */ /* */ void cma$thread_get_priority() ; /* */ /* The current user_assigned scheduler algorithm of a thread can be read. */ /* */ void cma$thread_get_sched() ; /* */ /* Operations on Mutexes */ /* */ /* */ /* Set whether mutex locks can nest. */ /* */ void cma$attr_set_mutex_kind() ; /* */ /* Obtain whether mutex locks can nest. */ /* */ void cma$attr_get_mutex_kind() ; /* */ /* The following routines create, delete, lock and unlock mutexes. */ /* */ void cma$mutex_create() ; /* */ /* Delete a mutex. */ /* */ void cma$mutex_delete() ; /* */ /* Lock a mutex. */ /* */ void cma$mutex_lock() ; /* */ /* Try to lock a mutex. */ /* */ cma$t_boolean cma$mutex_try_lock() ; /* */ /* Unlock a mutex. */ /* */ void cma$mutex_unlock() ; /* */ /* Lock Global mutex. */ /* */ void cma$lock_global() ; /* */ /* Unlock Global mutex. */ /* */ void cma$unlock_global() ; /* */ /* A thread can create and delete condition variables. */ /* */ void cma$cond_create() ; /* */ /* Delete a condition variable. */ /* */ void cma$cond_delete() ; /* */ /* A thread can signal to and broadcast on a condition variable. */ /* */ void cma$cond_broadcast() ; /* */ /* Signal a condition variable. */ /* */ void cma$cond_signal() ; /* */ /* Interupt signal a condition variable. */ /* */ void cma$cond_signal_int() ; /* */ /* A thread can wait for a condition variable to be signalled or broadcast. */ /* */ void cma$cond_wait() ; /* */ /* Operations for timed waiting */ /* */ /* */ /* A thread can perform a timed wait on a condition variable. */ /* */ cma$t_status cma$cond_timed_wait() ; /* */ /* A thread may perform some operations on absolute date-time and intervals. */ /* */ void cma$time_get_expiration() ; /* */ /* Operations for CMA and client initialization. */ /* */ /* */ /* Initialize the CMA facility. */ /* */ void cma$init() ; /* */ /* A thread can declare a one-time initialization routine. The address of */ /* the init block and routine are passed as parameters. */ /* */ typedef void (*cma$t_init_routine)(); /* */ /* Once routine */ /* */ void cma$once() ; /* */ /* Operations for per-thread context */ /* */ typedef void (*cma$t_destructor)(); /* */ /* A unique per-thread context key can be obtained for the process */ /* */ void cma$key_create() ; /* */ /* A thread can set a per-thread context value identified by a key. */ /* */ void cma$key_set_context() ; /* */ /* A thread can retrieve a per-thread context value identified by a key. */ /* */ void cma$key_get_context() ; /* */ /* Operations for alerts. */ /* */ /* */ /* The current thread can request that a thread terminate it's execution. */ /* */ void cma$thread_alert() ; /* */ /* The current thread can poll for alert delivery. */ /* */ void cma$alert_test() ; /* */ /* Control alert delivery state. */ /* */ void cma$alert_disable_asynch() ; void cma$alert_disable_general() ; void cma$alert_enable_asynch() ; void cma$alert_enable_general() ; void cma$alert_restore() ; /* */ /* Operations on stacks */ /* */ typedef void (*cma$t_call_routine)(); /* */ /* Assign a stack to a thread */ /* */ void cma$stack_assign_np() ; /* */ /* Call a routine on a new stack */ /* */ void cma$stack_call_routine_np() ; /* */ /* Check stack limit */ /* */ cma$t_boolean cma$stack_check_limit_np() ; /* */ /* Create a new stack */ /* */ void cma$stack_create_np() ; /* */ /* Delete a stack */ /* */ void cma$stack_delete_np() ; /* */ /* CMA Debug entry point */ /* */ void cma$debug() ; cma$t_integer cma$sigwait() ; /************************************************************************** */ /* */ /* The following are the portable CMA High-Level Library definitions */ /* */ /************************************************************************** */ /* */ /* Operations on attributes objects */ /* */ typedef cma$t_handle cma$lib_t_attr; /* */ /* An attributes object is created to specify the attributes of other CMA */ /* objects that will be created. */ /* */ void cma$lib_attr_create() ; /* */ /* An attributes object can be deleted when it is no longer needed. */ /* */ void cma$lib_attr_delete() ; /* */ /* Operations on queues */ /* */ typedef cma$t_handle cma$lib_t_queue; void cma$lib_queue_create() ; void cma$lib_queue_delete() ; void cma$lib_queue_dequeue() ; void cma$lib_queue_enqueue() ; cma$t_boolean cma$lib_queue_try_enqueue_int() ; void cma$lib_queue_requeue() ; cma$t_boolean cma$lib_queue_try_dequeue() ; cma$t_boolean cma$lib_queue_try_enqueue() ; cma$t_boolean cma$lib_queue_try_requeue() ; /* */ /* Set or obtain the default queue size */ /* */ void cma$lib_attr_get_queuesize() ; void cma$lib_attr_set_queuesize() ; #define sigaction cma$sigaction #if defined(vms) || defined(__vms) || defined (VMS) || defined(__VMS) || defined(__vms__) # if defined (__decc) || defined (__DECC) || (defined (__cplusplus) && defined (__DECCXX)) # pragma __extern_model __restore /* saved before including cma_config.h */ # endif #endif #pragma __standard /* set at top of this file */ #ifdef __cplusplus } #endif #endif /* ************************************************************************* * * * Copyright 2000 Compaq Computer Corporation * * * * COMPAQ Registered in U.S. Patent and Trademark Office. * * * * Confidential computer software. Valid license from Compaq or * * authorized sublicensor required for possession, use or copying. * * Consistent with FAR 12.211 and 12.212, Commercial Computer Software, * * Computer Software Documentation, and Technical Data for Commercial * * Items are licensed to the U.S. Government under vendor's standard * * commercial license. * * * * Compaq shall not be liable for technical or editorial errors or * * omissions contained herein. The information in this document is * * subject to change without notice. * * * ************************************************************************* */ /* * @(#)$RCSfile: cma_config.h,v $ $Revision: 1.1.25.1 $ (DEC) $Date: 2000/10/19 03:45:46 $ */ /* * FACILITY: * * DECthreads core * * ABSTRACT: * * Configuration header file to set up control symbols. * * AUTHORS: * * Dave Butenhof * * CREATION DATE: * * 26 January 1990 * * MODIFIED BY: * * Dave Butenhof * Bob Conti * Paul Curtin * Webb Scales * Brian Keane * Brian Silver * * LAST MODIFIED: * * 13 August 1998 */ #ifndef CMA_CONFIG #define CMA_CONFIG /* * INCLUDE FILES */ /* * CONFIGURATION SYMBOLS */ /* * Quick reference guide to the external DECthreads configuration symbols: * * _CMA_COMPILER_ (CC, VAXC, DECC, CFRONT, GCC, * DECCPLUS, GCPLUS, MSC) * Each compiler has its own quirks, and DECthreads * tries to do as much with each as possible. For * example, it instantiates function prototypes where * possible, even if the compiler is not fully ANSI C * compliant. * _CMA_HARDWARE_ (MIPS, VAX, ALPHA, X86, IA64) * The computer on which DECthreads will run. * _CMA_OS_ (UNIX, VMS, NT) * The operating system on which DECthreads will run; * generally, all UNIX-descended systems have certain * similarities which need to be considered as a group. * _CMA_PLATFORM_ (MIPS/UNIX, VAX/VMS, VAX/UNIX, ALPHA/UNIX, * ALPHA/VMS, ALPHA/NT, X86/NT, IA64/UNIX, * IA64/NT) * This is a convenience to test both hardware and O/S * variants together. * _CMA_PROTO_ (1 or undefined) * This is set if the compiler supports function * prototypes (if __STDC__ is true, or if any of a * number of specific compilers is being used). Note: * this must be tested by an #ifdef. * _CMA_OSIMPL_ (OSF, BSD, SYSV) * The closest ancestor of the UNIX operating system, * since each family inherits common characteristics * (particularly in signal behaviors). * _CMA_VOID_ (0, 1) * This is TRUE (1) if the compiler supports the use of * "void *" types. Most __STDC__ compilers do (except * that a version of MIPS C had a bug that prevented its * use). If _CMA_VOID_ is FALSE (0), DECthreads will use * "char *" instead. * _CMA_VOLATILE_ ("volatile" or "") * DECthreads requires "volatile" storage class in * several places, including exception handling. Since * some compilers do not support "volatile", DECthreads * uses this symbol in place of the "volatile" keyword. * Note that DECthreads runtimes built with compilers * that do not support volatile may show incorrect * behavior under certain circumstances (particularly * during delivery of exceptions). Because these * situations tend to occur only when errors have * already occurred, it is hoped that the absence of * volatile will not prevent normal DECthreads * operation. * _CMA_REENTRANT_CLIB_ (0, 1) * If TRUE (1) then the C library functions are thread * reentrant. * _CMA_IMPORT_, _CMA_EXPORT_ * Specifies the keywords used for EXPORTing variables * from DECthreads, or IMPORTing those variables to * client code. For normal UNIX systems, IMPORT is * usually "extern" and EXPORT is usually null. Because * of oddities in the VAX C implementation of extern, * DECthreads uses "globaldef" for EXPORT and * "globalref" for IMPORT. * _CMA_NOWRAPPERS_ (1 or undefined) * If defined, DECthreads will not use its I/O and C * library wrapper functions. Generally, this is set to * 1 for building DECthreads, and undefined for building * client code. [There is no default definition provided * for this symbol in this file, since the default is for * it to be undefined.] * _CMA_VSSCANF_ (0, 1) * If set to 1, the DECthreads stdio wrappers will * include the scanf family. The wrappers cannot be * built without the real "v*scanf" functions, which don't * exist on most platforms; but we're prepared if we * ever find a platform that does support them. Note that * we assume that using one symbol implicitly assumes * that if one of the v*scanf family is present, they * all will be. * _CMA_CONST_ ("const" or "") * Similar to _CMA_VOID_ and _CMA_VOLATILE_; used for the * I/O wrappers to make compliant with POSIX and ANSI C. * _CMA_RT4_KTHREAD_ (0, 1) * Set if O/S supports POSIX scheduling policies on * kernel threads. * _CMA_POSIX_SCHED_ (0, 1) * Set if DECthreads should support POSIX scheduling * policy & priorities. Set for all user-mode builds; * clear for kernel-thread builds unless O/S threads can * handle it. * _CMA_CALL_ ("__stdcall" or "") * Denotes the calling convention for an external routine. * Only significant on Windows NT systems. * */ /* * NOTE: all configuration symbols are set up such that they can be * overridden by a -D switch on the command line if desired (but be sure * that you know what you're doing). */ /* * Name of the platform C compiler */ #define _CMA__CC 1 #define _CMA__VAXC 2 #define _CMA__DECC 3 #define _CMA__CFRONT 4 #define _CMA__GCC 5 #define _CMA__DECCPLUS 6 #define _CMA__GCPLUS 7 #define _CMA__MSC 8 /* * Test for C++ compilers before C compilers because Glockenspiel C++ also * defines symbols for the VAX C compiler and this could be the case for * other C++/C compiler combinations */ #ifndef _CMA_COMPILER_ # if defined (__cplusplus) # if defined (__DECCXX) # define _CMA_COMPILER_ _CMA__DECCPLUS # elif defined (WIN32) || defined (_WIN32) # define _CMA_COMPILER_ _CMA__MSC # else # define _CMA_COMPILER_ _CMA__CFRONT # endif # elif defined (__decc) || defined (__DECC) # define _CMA_COMPILER_ _CMA__DECC # elif defined (vaxc) || defined (VAXC) || defined (__vaxc) || defined (__VAXC) # define _CMA_COMPILER_ _CMA__VAXC # elif defined (__GNUC__) || defined (__GNUC) || defined (__gnuc) # define _CMA_COMPILER_ _CMA__GCC # elif defined (WIN32) || defined (_WIN32) # define _CMA_COMPILER_ _CMA__MSC # else # define _CMA_COMPILER_ _CMA__CC # endif #endif /* * Name of the hardware platform */ #define _CMA__MIPS 1 #define _CMA__VAX 2 #define _CMA__ALPHA 3 #define _CMA__X86 4 #define _CMA__IA64 5 #ifndef _CMA_HARDWARE_ # if defined (vax) || defined (VAX) || defined (__vax) || defined (__VAX) # define _CMA_HARDWARE_ _CMA__VAX # elif defined (mips) || defined (MIPS) || defined (__mips) || defined (__MIPS) # define _CMA_HARDWARE_ _CMA__MIPS # elif defined (__ALPHA) || defined (__alpha) # define _CMA_HARDWARE_ _CMA__ALPHA # elif defined (_M_IX86) # define _CMA_HARDWARE_ _CMA__X86 # elif defined (__ia64__) # define _CMA_HARDWARE_ _CMA__IA64 # else ! error _CMA_HARDWARE_ not set # endif #endif /* * Name of the software platform (i.e., the OS) */ #define _CMA__UNIX 1 #define _CMA__VMS 2 #define _CMA__WIN32 3 #define _CMA__NT _CMA__WIN32 /* for compatibility */ #ifndef _CMA_OS_ # if defined (unix) || defined (__unix) || defined (__OSF__) || defined (__osf__) # define _CMA_OS_ _CMA__UNIX # elif defined (vms) || defined (__vms) || defined (VMS) || defined (__VMS) # define _CMA_OS_ _CMA__VMS # elif defined (WIN32) || defined (_WIN32) # define _CMA_OS_ _CMA__WIN32 # else ! error _CMA_OS_ not set # endif #endif /* * Combined platform (OS + hardware) */ #define _CMA__MIPS_UNIX 1 #define _CMA__VAX_VMS 2 #define _CMA__VAX_UNIX 3 #define _CMA__ALPHA_UNIX 4 #define _CMA__ALPHA_VMS 5 #define _CMA__ALPHA_WIN32 6 #define _CMA__ALPHA_NT _CMA__ALPHA_WIN32 /* for compatibility */ #define _CMA__X86_WIN32 7 #define _CMA__X86_NT _CMA__X86_WIN32 /* for compatibility */ #define _CMA__IA64_UNIX 8 #define _CMA__IA64_WIN32 9 #define _CMA__IA64_NT _CMA__IA64_WIN32 /* for compatibility */ #ifndef _CMA_PLATFORM_ # if _CMA_OS_ == _CMA__UNIX # if _CMA_HARDWARE_ == _CMA__MIPS # define _CMA_PLATFORM_ _CMA__MIPS_UNIX # elif _CMA_HARDWARE_ == _CMA__VAX # define _CMA_PLATFORM_ _CMA__VAX_UNIX # elif _CMA_HARDWARE_ == _CMA__ALPHA # define _CMA_PLATFORM_ _CMA__ALPHA_UNIX # elif _CMA_HARDWARE_ == _CMA__IA64 # define _CMA_PLATFORM_ _CMA__IA64_UNIX # else ! error Undefined Unix hardware platform # endif # elif _CMA_OS_ == _CMA__VMS # if _CMA_HARDWARE_ == _CMA__VAX # define _CMA_PLATFORM_ _CMA__VAX_VMS # elif _CMA_HARDWARE_ == _CMA__ALPHA # define _CMA_PLATFORM_ _CMA__ALPHA_VMS # else ! error Undefined VMS hardware platform # endif # elif _CMA_OS_ == _CMA__WIN32 # if _CMA_HARDWARE_ == _CMA__X86 # define _CMA_PLATFORM_ _CMA__X86_WIN32 # elif _CMA_HARDWARE_ == _CMA__ALPHA # define _CMA_PLATFORM_ _CMA__ALPHA_WIN32 # elif _CMA_HARDWARE_ == _CMA__IA64 # define _CMA_PLATFORM_ _CMA__IA64_WIN32 # else ! error Undefined Win32 hardware platform # endif # else ! error _CMA_PLATFORM_ not set # endif #endif /* * Unix derivative (default to BSD) */ #define _CMA__OS_OSF 1 #define _CMA__OS_BSD 2 #define _CMA__OS_SYSV 3 #ifndef _CMA_OSIMPL_ # if _CMA_OS_ == _CMA__UNIX # ifdef __osf__ # define _CMA_OSIMPL_ _CMA__OS_OSF # elif 0 # define _CMA_OSIMPL_ _CMA__OS_SYSV # else # define _CMA_OSIMPL_ _CMA__OS_BSD # endif # else # define _CMA_OSIMPL_ 0 /* Not an implementation of Unix */ # endif #endif /* * This controls whether ANSI C function prototypes are used for CMA * interfaces. */ #ifndef _CMA_PROTO_ # if !((_CMA_PLATFORM_ == _CMA__VAX_UNIX) && (_CMA_COMPILER_ == _CMA__CC)) # define _CMA_PROTO_ 1 # endif #else # if _CMA_PROTO_ == 0 # undef _CMA_PROTO_ /* _CMA_PROTO_ is undefined, which means do not use prototypes. */ # endif #endif #ifdef _CMA_PROTO_ # define _CMA_PROTOTYPE_(arg) arg #else # define _CMA_PROTOTYPE_(arg) () #endif /* * Define a macro to control calling convention. Only significant on * Windows NT. */ #ifndef _CMA_CALL_ # if _CMA_OS_ == _CMA__WIN32 # define _CMA_CALL_ __stdcall # else # define _CMA_CALL_ # endif #endif /* * Define whether to use "void *" or "char *" pointers, based on whether the * compiler can support them. */ #ifndef _CMA_VOID_ # if (_CMA_PLATFORM_ == _CMA__VAX_UNIX) && (_CMA_COMPILER_ == _CMA__CC) # define _CMA_VOID_ 0 # else # define _CMA_VOID_ 1 # endif #endif /* * Set this to "volatile" unless using a deficient compiler. */ #ifndef _CMA_VOLATILE_ # if (_CMA_PLATFORM_ == _CMA__VAX_UNIX) && (_CMA_COMPILER_ == _CMA__CC) # define _CMA_VOLATILE_ # elif _CMA_COMPILER_ == _CMA__CFRONT # define _CMA_VOLATILE_ # else # define _CMA_VOLATILE_ volatile # endif #endif /* * Kernel-threads type. * (These are values used to define _CMA_KTHREADS_in cma_os.h) */ #define _CMA__NONE 0 #define _CMA__MACH 1 #define _CMA__NTTHREADS 2 /* * _CMA_REENTRANT_CLIB_ is true IFF the platform's C library is reentrant. */ #ifndef _CMA_REENTRANT_CLIB_ # if _CMA_OSIMPL_ == _CMA__OS_OSF # define _CMA_REENTRANT_CLIB_ 1 # elif (_CMA_COMPILER_ == _CMA__DECC) || (_CMA_COMPILER_ == _CMA__DECCPLUS) # define _CMA_REENTRANT_CLIB_ 1 # elif _CMA_OS_ == _CMA__WIN32 # define _CMA_REENTRANT_CLIB_ 1 # else # define _CMA_REENTRANT_CLIB_ 0 # endif #endif /* * Define the symbols used to "import" and "export" symbols for the client * interface. Note that these shouldn't be used for symbols shared only * between CMA modules; it's for those symbols which are "imported" in the * cma.h (or pthread.h) header files, such as cma_c_null, * pthread_attr_default, and the exception names. */ #if _CMA_OS_ == _CMA__VMS # if ((_CMA_COMPILER_ == _CMA__DECC) || (_CMA_COMPILER_ == _CMA__DECCPLUS)) # define _CMA_IMPORT_ extern # define _CMA_EXPORT_ # elif _CMA_COMPILER_ == _CMA__VAXC # define _CMA_IMPORT_ globalref # define _CMA_EXPORT_ globaldef # endif #else # define _CMA_IMPORT_ extern # define _CMA_EXPORT_ #endif /* * True if the system supplies the vsscanf() function */ #ifndef _CMA_VSSCANF_ # define _CMA_VSSCANF_ 0 #endif /* * ANSI C defines some parameters using the const modifier. Use this macro * to make the function signatures ANSI and POSIX compliant for STDIO and * thread I/O. wrappers. Size_t is defined by including stdio.h which is * included in cma_stdio.h and cma_stdio.c */ #if defined (__STDC__) || (_CMA_COMPILER_ == _CMA__MSC) # define _CMA_CONST_ const # define _CMA_SIZE_T size_t #else # define _CMA_CONST_ # define _CMA_SIZE_T unsigned int #endif /* * Set a symbol if we're building a kernel thread version on a system that * supports POSIX.4 scheduling semantics for kernel threads. */ #ifndef _CMA_RT4_KTHREAD_ # if _CMA_OSIMPL_ == _CMA__OS_OSF # define _CMA_RT4_KTHREAD_ 1 # else # define _CMA_RT4_KTHREAD_ 0 # endif #endif /* * _CMA_POSIX_SCHED_ is true if not kernel threads, or if it's a specific * type of kernel threads that supports POSIX scheduling. */ #ifndef _CMA_POSIX_SCHED_ # if _CMA_OS_ != _CMA__WIN32 # define _CMA_POSIX_SCHED_ 1 # else # define _CMA_POSIX_SCHED_ 0 # endif #endif #endif /* CMA_CONFIG */ /* ************************************************************************* * * * Copyright 2000 Compaq Computer Corporation * * * * COMPAQ Registered in U.S. Patent and Trademark Office. * * * * Confidential computer software. Valid license from Compaq or * * authorized sublicensor required for possession, use or copying. * * Consistent with FAR 12.211 and 12.212, Commercial Computer Software, * * Computer Software Documentation, and Technical Data for Commercial * * Items are licensed to the U.S. Government under vendor's standard * * commercial license. * * * * Compaq shall not be liable for technical or editorial errors or * * omissions contained herein. The information in this document is * * subject to change without notice. * * * ************************************************************************* */ /* * @(#)$RCSfile: cma_library.h,v $ $Revision: 1.1.19.1 $ (DEC) $Date: 2000/03/01 15:43:24 $ */ /* * FACILITY: * * DECthreads Library services * * ABSTRACT: * * External definitions for DECthreads Library services * * AUTHORS: * * Webb Scales * * CREATION DATE: * * 7 August 1990 * * MODIFIED BY: * * Webb Scales * Dave Butenhof * Peter Portante * */ #ifndef CMA_LIB_INCLUDE #define CMA_LIB_INCLUDE #include #ifdef __cplusplus extern "C" { #endif /* * The following are the portable CMA High-Level Library definitions */ /* * Operations on attributes objects */ typedef cma_t_handle cma_lib_t_attr; /* * An attributes object is created to specify the attributes of other CMA * objects that will be created. */ extern void cma_lib_attr_create _CMA_PROTOTYPE_ (( cma_lib_t_attr *new_attr, cma_lib_t_attr *attr)); /* * An attributes object can be deleted when it is no longer needed. */ extern void cma_lib_attr_delete _CMA_PROTOTYPE_ (( cma_lib_t_attr *attr)); /* * Operations on queues */ typedef cma_t_handle cma_lib_t_queue; extern void cma_lib_queue_create _CMA_PROTOTYPE_ (( cma_lib_t_queue *new_queue, cma_lib_t_attr *att)); extern void cma_lib_queue_delete _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue)); extern void cma_lib_queue_dequeue _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address *element)); extern void cma_lib_queue_enqueue _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address element)); extern cma_t_boolean cma_lib_queue_try_enqueue_int _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address element)); extern void cma_lib_queue_requeue _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address element)); extern cma_t_boolean cma_lib_queue_try_dequeue _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address *element)); extern cma_t_boolean cma_lib_queue_try_enqueue _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address element)); extern cma_t_boolean cma_lib_queue_try_requeue _CMA_PROTOTYPE_ (( cma_lib_t_queue *queue, cma_t_address element)); /* * Set or obtain the default queue size */ extern void cma_lib_attr_get_queuesize _CMA_PROTOTYPE_ (( cma_lib_t_attr *attr, cma_t_natural *queuesize)); extern void cma_lib_attr_set_queuesize _CMA_PROTOTYPE_ (( cma_lib_t_attr *attr, cma_t_natural queuesize)); #ifdef __cplusplus } #endif #endif /* ************************************************************************* * * * Copyright 2000 Compaq Computer Corporation * * * * COMPAQ Registered in U.S. Patent and Trademark Office. * * * * Confidential computer software. Valid license from Compaq or * * authorized sublicensor required for possession, use or copying. * * Consistent with FAR 12.211 and 12.212, Commercial Computer Software, * * Computer Software Documentation, and Technical Data for Commercial * * Items are licensed to the U.S. Government under vendor's standard * * commercial license. * * * * Compaq shall not be liable for technical or editorial errors or * * omissions contained herein. The information in this document is * * subject to change without notice. * * * ************************************************************************* */ /* * @(#)$RCSfile: cma_tis.h,v $ $Revision: 1.1.14.1 $ (DEC) $Date: 2000/10/19 16:19:41 $ */ /* * FACILITY: * * Thread-Independent Synchronization, a subsidiary of DECthreads * * ABSTRACT: * * This header defines OBSOLETE interfaces. While programs using these * interfaces will continue to be supported, Digital recommends that you * use the improved interfaces described in . * * AUTHORS: * * Webb Scales * * CREATION DATE: * * 29 April 1992 * * MODIFIED BY: * * Dave Butenhof * Peter Portante * Webb Scales * Mary Sullivan * * LAST MODIFIED: * * 13 May 1998 */ #ifndef _CMA_TIS_ #define _CMA_TIS_ /* * CMA_TIS configuration symbols */ #define _CMA_TIS__OSF 1 #define _CMA_TIS__VMS 2 #ifndef _CMA_TIS_OS_ # if defined (__OSF__) || defined (__osf__) # define _CMA_TIS_OS_ _CMA_TIS__OSF # elif defined (vms) || defined (__vms) || defined (__VMS) # define _CMA_TIS_OS_ _CMA_TIS__VMS # elif defined (_WIN32) || defined (WIN32) # define _CMA_TIS_OS_ _CMA_TIS__WIN32 # else # error _CMA_TIS_OS_ is undefined # endif #endif #define _CMA_TIS__ALPHA 1 #define _CMA_TIS__VAX 2 #define _CMA_TIS__X86 3 #define _CMA_TIS__IA64 4 #ifndef _CMA_TIS_HARDWARE_ # if defined (__alpha) || defined (__ALPHA) # define _CMA_TIS_HARDWARE_ _CMA_TIS__ALPHA # elif defined (vax) || defined (__vax) || defined (__VAX) # define _CMA_TIS_HARDWARE_ _CMA_TIS__VAX # elif defined (_M_IX86) # define _CMA_TIS_HARDWARE_ _CMA_TIS__X86 # elif defined (__ia64__) # define _CMA_TIS_HARDWARE_ _CMA_TIS__IA64 # else # error _CMA_TIS_HARDWARE_ is undefined # endif #endif #ifdef __cplusplus extern "C" { #endif /* * On OpenVMS Alpha, make sure that all the "obsolete" TIS interfaces treat * client values as strictly 32-bit addresses for compatibility. If you need * 64 bit pointers, you must upgrade to the "native" TIS interfaces. */ #if (_CMA_TIS_OS_ == _CMA_TIS__VMS) && (_CMA_TIS_HARDWARE_ == _CMA_TIS__ALPHA) # if __INITIAL_POINTER_SIZE == 64 # pragma __required_pointer_size __save # pragma __required_pointer_size __short # endif #endif /* * General address type */ typedef void *cma_tis_addr_t; /* * TIS condition variable: the address of an internal condition variable object. */ typedef cma_tis_addr_t cma_tis_cond_t; /* * TIS mutex: the address of an internal mutex object. */ typedef cma_tis_addr_t cma_tis_mutex_t; #if (_CMA_TIS_OS_ == _CMA_TIS__VMS) && (_CMA_TIS_HARDWARE_ == _CMA_TIS__ALPHA) # if __INITIAL_POINTER_SIZE == 64 # pragma __required_pointer_size __restore # endif #endif /* * TIS one-time initialization control block and its initialization macro. * * Declare a one time initialization control block as: * * static cma_tis_once_t block = cma_tis_once_init; */ typedef struct cma_tis_once_tag { long field1; long field2; long field3; } cma_tis_once_t; #define cma_tis_once_init {0, 0, 0} /* * Per-thread context types */ typedef long cma_tis_key_t; typedef void (*cma_tis_destructor_t) (cma_tis_addr_t value); /* * TIS thread-ID: the address of a internal thread object. */ typedef cma_tis_addr_t cma_tis_thread_t; #if _CMA_TIS_OS_ == _CMA_TIS__VMS /* * On VMS, these routines must begin with "CMA$" not "cma_", so use a * macro to translate on those platforms. */ # pragma nostandard # define cma_tis_errno_get_addr CMA$TIS_ERRNO_GET_ADDR # define cma_tis_errno_set_value CMA$TIS_ERRNO_SET_VALUE # define cma_tis_vmserrno_get_addr CMA$TIS_VMSERRNO_GET_ADDR # define cma_tis_vmserrno_set_value CMA$TIS_VMSERRNO_SET_VALUE # define cma_tis_cond_create CMA$TIS_COND_CREATE # define cma_tis_cond_delete CMA$TIS_COND_DELETE # define cma_tis_cond_broadcast CMA$TIS_COND_BROADCAST # define cma_tis_cond_signal CMA$TIS_COND_SIGNAL # define cma_tis_cond_wait CMA$TIS_COND_WAIT # define cma_tis_key_create CMA$TIS_KEY_CREATE # define cma_tis_key_get_context CMA$TIS_KEY_GET_CONTEXT # define cma_tis_key_set_context CMA$TIS_KEY_SET_CONTEXT # define cma_tis_lock_global CMA$TIS_LOCK_GLOBAL # define cma_tis_mutex_create CMA$TIS_MUTEX_CREATE # define cma_tis_mutex_delete CMA$TIS_MUTEX_DELETE # define cma_tis_mutex_lock CMA$TIS_MUTEX_LOCK # define cma_tis_mutex_trylock CMA$TIS_MUTEX_TRYLOCK # define cma_tis_mutex_unlock CMA$TIS_MUTEX_UNLOCK # define cma_tis_once CMA$TIS_ONCE # define cma_tis_thread_get_self CMA$TIS_THREAD_GET_SELF # define cma_tis_unlock_global CMA$TIS_UNLOCK_GLOBAL # pragma standard #endif /* * TIS functions. */ #if (_CMA_TIS_OS_ == _CMA_TIS__VMS) && (_CMA_TIS_HARDWARE_ == _CMA_TIS__ALPHA) # if __INITIAL_POINTER_SIZE == 64 # pragma __required_pointer_size __save # pragma __required_pointer_size __short # endif #endif /* * Get the address of errno */ extern int * cma_tis_errno_get_addr (void); /* * Set all known errno cells to a particular value */ extern void cma_tis_errno_set_value ( int value); #if _CMA_TIS_OS_ == _CMA_TIS__VMS /* * Get the address of the VMS-specific errno */ extern int * cma_tis_vmserrno_get_addr (void); /* * Set all known VMS-specific errno cells to a particular value */ extern void cma_tis_vmserrno_set_value ( int value); #endif /* * Create a TIS condition variable. * * "cond" is a pointer to an abstract condition variable, passed by reference, * which receives the address of the new condition variable object. */ extern int cma_tis_cond_create ( cma_tis_cond_t *cond); /* * Delete a TIS condition variable * * "cond" is the address of the abstract condition variable, passed by * reference, which is to be deleted. */ extern int cma_tis_cond_delete ( cma_tis_cond_t *cond); /* * Broadcast on a TIS condition variable * * "cond" is the address of the abstract condition variable, passed by * reference, on which to broadcast. */ extern int cma_tis_cond_broadcast ( cma_tis_cond_t *cond); /* * Signal a TIS condition variable * * "cond" is the address of the abstract condition variable, passed by * reference, on which to signal. */ extern int cma_tis_cond_signal ( cma_tis_cond_t *cond); /* * Wait on a TIS condition variable * * "cond" is the address of the abstract condition variable, passed by * reference, on which to wait. "mutex" is the address of the abstract mutex, * passed by reference, which is associated with "cond". */ extern int cma_tis_cond_wait ( cma_tis_cond_t *cond, cma_tis_mutex_t *mutex); /* * Lock and unlock the DECthreads global lock (if present). */ extern int cma_tis_lock_global (void); extern int cma_tis_unlock_global (void); /* * Create a per-thread context (also known as "thread-specific storage" key). * * "Key" is the address of a cell which will receive the key value; this * value is used in calls to cma_tis_key_set_context() and * cma_tis_key_get_context() to get and set the per-thread context associated * with this key. The same key value is used in each thread to access that * thread's context. * "Destructor" is the address of a routine which is called to destroy * (e.g., deallocate) the per-thread context value when the thread terminates. */ extern int cma_tis_key_create ( cma_tis_key_t *key, cma_tis_destructor_t destructor); /* * Get the per-thread context value associated with a particular key. * * "Key" is a key value returned by a call to cma_tis_key_create(). * "Value" is the address of a cell which will receive the per-thread context * value associated with this key. The value returned is dependent on the * value of the key specified, but unaffected by the actions of any other * threads. */ extern int cma_tis_key_get_context ( cma_tis_key_t key, cma_tis_addr_t *value); /* * Set the per-thread context value associated with a particular key. * * "Key" is a key value returned by a call to cma_tis_key_create(). * "Value" is value to be associated with this key. Once set, this value * can be retrieved in this thread using the same key in a call to * cma_tis_key_get_context(); however, other threads' use of this key value * is unaffected. */ extern int cma_tis_key_set_context ( cma_tis_key_t key, cma_tis_addr_t value); /* * Create a TIS mutex * * "mutex" is a pointer to an abstract mutex, passed by reference, which * receives the address of the new mutex object. */ extern int cma_tis_mutex_create ( cma_tis_mutex_t *mutex); /* * Delete a TIS mutex * * "mutex" is the address of the abstract mutex, passed by reference, which is * to be deleted. */ extern int cma_tis_mutex_delete ( cma_tis_mutex_t *mutex); /* * Lock a TIS mutex * * "mutex" is the address of the abstract mutex, passed by reference, which is * to be locked. */ extern int cma_tis_mutex_lock ( cma_tis_mutex_t *mutex); /* * Non-blocking TIS mutex lock * * "mutex" is the address of the abstract mutex, passed by reference, which is * to be locked. * * The function returns a boolean value indicating if the mutex was * successfully locked. */ extern int cma_tis_mutex_trylock ( cma_tis_mutex_t *mutex); /* * Unlock a TIS mutex * * "mutex" is the address of the abstract mutex, passed by reference, which is * to be unlocked. */ extern int cma_tis_mutex_unlock ( cma_tis_mutex_t *mutex); /* * Execute a one-time initialization routine. * * The specified routine is called exactly once during a program's execution, * even if multiple threads call cma_tis_once() simultaneously. This is * useful for performing one-time initialization tasks (e.g., for a facility * API), such as creating mutexes and per-thread-context keys. * * "init_block" is the address of a one-time initialization control block. This * should be in static storage and unique to the initialization routine. * "init_routine" is the address of the initialization routine to call. * "arg" is a user argument which is passed to the initialization routine. */ extern int cma_tis_once ( cma_tis_once_t *init_block, void (*init_rtn) (cma_tis_addr_t arg), cma_tis_addr_t init_arg); /* * Get current thread "ID". (Returns zero if there are no threads.) */ extern cma_tis_thread_t cma_tis_thread_get_self (void); #if (_CMA_TIS_OS_ == _CMA_TIS__VMS) && (_CMA_TIS_HARDWARE_ == _CMA_TIS__ALPHA) # if __INITIAL_POINTER_SIZE == 64 # pragma __required_pointer_size __restore # endif #endif #ifdef __cplusplus } #endif #endif /* _CMA_TIS_ */