[PEN_CHECKING_STYLE(NONE)] MODULE PASCAL$CMA_ROUTINES; { © Copyright 2005 Hewlett-Packard Development Company, L.P. } { } { Confidential computer software. Valid license from HP and/or } { its subsidiaries 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. } { } { Neither HP nor any of its subsidiaries shall be liable for technical } { or editorial errors or omissions contained herein. The information } { in this document is provided "as is" without warranty of any kind and } { is subject to change without notice. The warranties for HP products } { are set forth in the express limited warranty statements accompanying } { such products. Nothing herein should be construed as constituting an } { additional warranty. } { } [HIDDEN] TYPE (**** Pre-declared data types ****) $BYTE = [BYTE] -128..127; $WORD = [WORD] -32768..32767; $QUAD = [QUAD,UNSAFE] RECORD L0:UNSIGNED; L1:INTEGER; END; $OCTA = [OCTA,UNSAFE] RECORD L0,L1,L2:UNSIGNED; L3:INTEGER; END; $UBYTE = [BYTE] 0..255; $UWORD = [WORD] 0..65535; $UQUAD = [QUAD,UNSAFE] RECORD L0,L1:UNSIGNED; END; $UOCTA = [OCTA,UNSAFE] RECORD L0,L1,L2,L3:UNSIGNED; END; $PACKED_DEC = [BIT(4),UNSAFE] 0..15; $DEFTYP = [UNSAFE] INTEGER; $DEFPTR = [UNSAFE] ^$DEFTYP; $BOOL = [BIT(1),UNSAFE] BOOLEAN; $BIT = [BIT(1),UNSAFE] BOOLEAN; $BIT2 = [BIT(2),UNSAFE] 0..3; $BIT3 = [BIT(3),UNSAFE] 0..7; $BIT4 = [BIT(4),UNSAFE] 0..15; $BIT5 = [BIT(5),UNSAFE] 0..31; $BIT6 = [BIT(6),UNSAFE] 0..63; $BIT7 = [BIT(7),UNSAFE] 0..127; $BIT8 = [BIT(8),UNSAFE] 0..255; $BIT9 = [BIT(9),UNSAFE] 0..511; $BIT10 = [BIT(10),UNSAFE] 0..1023; $BIT11 = [BIT(11),UNSAFE] 0..2047; $BIT12 = [BIT(12),UNSAFE] 0..4095; $BIT13 = [BIT(13),UNSAFE] 0..8191; $BIT14 = [BIT(14),UNSAFE] 0..16383; $BIT15 = [BIT(15),UNSAFE] 0..32767; $BIT16 = [BIT(16),UNSAFE] 0..65535; $BIT17 = [BIT(17),UNSAFE] 0..131071; $BIT18 = [BIT(18),UNSAFE] 0..262143; $BIT19 = [BIT(19),UNSAFE] 0..524287; $BIT20 = [BIT(20),UNSAFE] 0..1048575; $BIT21 = [BIT(21),UNSAFE] 0..2097151; $BIT22 = [BIT(22),UNSAFE] 0..4194303; $BIT23 = [BIT(23),UNSAFE] 0..8388607; $BIT24 = [BIT(24),UNSAFE] 0..16777215; $BIT25 = [BIT(25),UNSAFE] 0..33554431; $BIT26 = [BIT(26),UNSAFE] 0..67108863; $BIT27 = [BIT(27),UNSAFE] 0..134217727; $BIT28 = [BIT(28),UNSAFE] 0..268435455; $BIT29 = [BIT(29),UNSAFE] 0..536870911; $BIT30 = [BIT(30),UNSAFE] 0..1073741823; $BIT31 = [BIT(31),UNSAFE] 0..2147483647; $BIT32 = [BIT(32),UNSAFE] UNSIGNED; (* MODULE CMA$DEF ; *) (* [HIDDEN] TYPE (**** Pre-declared data types ***?? *) (* $BYTE = [BYTE] -128..127; *) (* $WORD = [WORD] -32768..32767; *) (* $QUAD = [QUAD,UNSAFE] RECORD *) (* L0:UNSIGNED; L1:INTEGER; END; *) (* $OCTA = [OCTA,UNSAFE] RECORD *) (* L0,L1,L2:UNSIGNED; L3:INTEGER; END; *) (* $UBYTE = [BYTE] 0..255; *) (* $UWORD = [WORD] 0..65535; *) (* $UQUAD = [QUAD,UNSAFE] RECORD *) (* L0,L1:UNSIGNED; END; *) (* $UOCTA = [OCTA,UNSAFE] RECORD *) (* L0,L1,L2,L3:UNSIGNED; END; *) (* $UOCTAQUAD = [OCTA(2),UNSAFE] RECORD *) (* L0,L1,L2,L3,L4,L5,L6,L7:UNSIGNED; END; *) (* $PACKED_DEC = [BIT(4),UNSAFE] 0..15; *) (* $DEFTYP = [UNSAFE] INTEGER; *) (* $DEFPTR = [UNSAFE] ^$DEFTYP; *) (* $BOOL = [BIT(1),UNSAFE] BOOLEAN; *) (* $BIT2 = [BIT(2),UNSAFE] 0..3; *) (* $BIT3 = [BIT(3),UNSAFE] 0..7; *) (* $BIT4 = [BIT(4),UNSAFE] 0..15; *) (* $BIT5 = [BIT(5),UNSAFE] 0..31; *) (* $BIT6 = [BIT(6),UNSAFE] 0..63; *) (* $BIT7 = [BIT(7),UNSAFE] 0..127; *) (* $BIT8 = [BIT(8),UNSAFE] 0..255; *) (* $BIT9 = [BIT(9),UNSAFE] 0..511; *) (* $BIT10 = [BIT(10),UNSAFE] 0..1023; *) (* $BIT11 = [BIT(11),UNSAFE] 0..2047; *) (* $BIT12 = [BIT(12),UNSAFE] 0..4095; *) (* $BIT13 = [BIT(13),UNSAFE] 0..8191; *) (* $BIT14 = [BIT(14),UNSAFE] 0..16383; *) (* $BIT15 = [BIT(15),UNSAFE] 0..32767; *) (* $BIT16 = [BIT(16),UNSAFE] 0..65535; *) (* $BIT17 = [BIT(17),UNSAFE] 0..131071; *) (* $BIT18 = [BIT(18),UNSAFE] 0..262143; *) (* $BIT19 = [BIT(19),UNSAFE] 0..524287; *) (* $BIT20 = [BIT(20),UNSAFE] 0..1048575; *) (* $BIT21 = [BIT(21),UNSAFE] 0..2097151; *) (* $BIT22 = [BIT(22),UNSAFE] 0..4194303; *) (* $BIT23 = [BIT(23),UNSAFE] 0..8388607; *) (* $BIT24 = [BIT(24),UNSAFE] 0..16777215; *) (* $BIT25 = [BIT(25),UNSAFE] 0..33554431; *) (* $BIT26 = [BIT(26),UNSAFE] 0..67108863; *) (* $BIT27 = [BIT(27),UNSAFE] 0..134217727; *) (* $BIT28 = [BIT(28),UNSAFE] 0..268435455; *) (* $BIT29 = [BIT(29),UNSAFE] 0..536870911; *) (* $BIT30 = [BIT(30),UNSAFE] 0..1073741823; *) (* $BIT31 = [BIT(31),UNSAFE] 0..2147483647; *) (* $BIT32 = [BIT(32),UNSAFE] UNSIGNED; *) (*** MODULE CMA$DEF IDENT V3.15-001 ***) (* *) (* 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 *) (* Brian Keane *) (* Webb Scales *) (* *) (* *) (* 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. *) (* *) CONST _DECTHREADS_ = 1; TYPE cma$t_integer =INTEGER; cma$t_boolean =UNSIGNED; cma$t_natural =UNSIGNED; cma$t_interval =SINGLE; cma$t_key =INTEGER; cma$t_status =INTEGER; cma$t_priority =INTEGER; cma$t_address =^CHAR; CONST cma$c_prio_fifo_min = 16; cma$c_prio_fifo_mid = 24; cma$c_prio_fifo_max = 31; cma$c_prio_rr_min = 16; cma$c_prio_rr_mid = 24; cma$c_prio_rr_max = 31; cma$c_prio_through_min = 8; cma$c_prio_through_mid = 12; cma$c_prio_through_max = 15; cma$c_prio_back_min = 0; cma$c_prio_back_mid = 4; cma$c_prio_back_max = 7; cma$c_prio_ada_low_min = 0; cma$c_prio_ada_low_mid = 4; cma$c_prio_ada_low_max = 7; cma$c_prio_ada_rtb_min = 0; cma$c_prio_ada_rtb_mid = 4; 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. *) (* *) TYPE cma$t_date_time = RECORD low : UNSIGNED; high : UNSIGNED; END; (* *) (* Sample decisions for what handles shall be *) (* *) TYPE cma$t_handle = RECORD handle_field1 : cma$t_natural; handle_field2 : cma$t_natural; END; CONST cma$c_handle_size = 8; (* *) (* Sample decision for a one-time initialization control block and its *) (* initialization macro. *) (* *) (* *) TYPE cma$t_once = RECORD once_field1 : cma$t_integer; once_field2 : cma$t_integer; once_field3 : cma$t_integer; END; (* *) (* Sample decision for a variable to save the current alert state. *) (* *) TYPE cma$t_alert_state = RECORD state1 : cma$t_integer; state2 : cma$t_integer; END; (* *) (* The following are the portable CMA definitions *) (* *) (* *) (* Operations on threads *) (* *) TYPE cma$t_start_routine =^$DEFTYP (* entry *); (* *) (* Constants *) (* *) CONST cma$c_false = 0; cma$c_true = 1; cma$c_null_ptr = 0; (* *) (* Objects *) (* *) TYPE cma$t_mutex = RECORD (* Needed for ONCE_BLOCK *) END; cma$t_attr = RECORD END; cma$t_thread = RECORD END; cma$t_cond = RECORD END; cma$t_stack_np = RECORD END; (* *) (* Predefined null handle *) (* *) VAR cma$c_null : RECORD END; (* *) (* Exit status constants *) (* *) TYPE cma$t_exit_status =INTEGER; CONST cma$c_term_error = 0; cma$c_term_normal = 1; cma$c_term_alert = 2; cma$c_null_thread = -1; (* *) (* Schedule inheritance constants *) (* *) TYPE cma$t_sched_inherit =INTEGER; CONST cma$c_sched_inherit = 0; cma$c_sched_use_default = 1; (* *) (* Schedule policy constants *) (* *) TYPE cma$t_sched_policy =INTEGER; CONST 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; (* *) (* Default and other policies. *) (* *) CONST cma$c_sched_default = 2; cma$c_sched_other = 2; (* *) (* Mutex types *) (* *) TYPE cma$t_mutex_kind =INTEGER; CONST cma$c_mutex_fast = 0; cma$c_mutex_recursive = 1; cma$c_mutex_nonrecursive = 2; (* *) (* 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 *) (* *) CONST cma$_exception = 4227084; cma$_exccop = 4227092; cma$_uninitexc = 4227100; cma$_unkstatus = 4228100; cma$_exccoplos = 4228108; cma$_illaddr = 12; cma$_exquota = 28; cma$_insfmem = 292; cma$_nopriv = 36; cma$_normal = 1; cma$_illinstr = 1084; cma$_resaddr = 1100; cma$_privinst = 1084; cma$_resoper = 1108; cma$_SIGTRAP = 1044; cma$_SIGIOT = 44; cma$_SIGEMT = 1068; cma$_aritherr = 1164; cma$_SIGSYS = 20; cma$_SIGPIPE = 628; cma$_excpu = 8364; cma$_exfilsiz = 1004; cma$_intovf = 1148; cma$_intdiv = 1156; cma$_fltovf = 1164; cma$_fltdiv = 1172; cma$_fltund = 1180; cma$_decovf = 1188; cma$_subrng = 1196; cma$_accvio = 12; cma$_SIGILL = 1084; cma$_SIGFPE = 1164; cma$_SIGBUS = 1084; cma$_SIGSEGV = 1084; cma$_SIGXCPU = 8364; cma$_SIGXFSZ = 1004; cma$_alerted = 4227460; cma$_assertion = 4227468; cma$_badparam = 4227476; cma$_bugcheck = 4227484; cma$_exit_thread = 4227492; cma$_existence = 4227500; cma$_in_use = 4227508; cma$_use_error = 4227516; cma$_wrongmutex = 4227524; cma$_stackovf = 554; cma$_nostackmem = 4227540; cma$_notcmastack = 4227548; cma$_timed_out = 4227556; cma$_unimp = 4227564; cma$_inialrpro = 4227572; cma$_defer_q_full = 4227580; cma$_signal_q_full = 4227588; cma$_alert_nesting = 4227596; (* *) (* EXCEPTION TYPE DEFINITIONS *) (* *) TYPE cma$exc_address_t =^CHAR; cma$exc_kind_t =INTEGER; cma$exc_int_t =INTEGER; (* *) (* Internal contents of an exception object. *) (* *) TYPE cma$t_exception = RECORD exc_kind : cma$exc_kind_t; exc_info : cma$exc_address_t; exc_filler : ARRAY [1..6] OF cma$exc_address_t; END; VAR cma$e_uninitexc : RECORD END; cma$e_illaddr : RECORD END; cma$e_exquota : RECORD END; cma$e_insfmem : RECORD END; cma$e_nopriv : RECORD END; cma$e_illinstr : RECORD END; cma$e_resaddr : RECORD END; cma$e_privinst : RECORD END; cma$e_resoper : RECORD END; cma$e_SIGTRAP : RECORD END; cma$e_SIGIOT : RECORD END; cma$e_SIGEMT : RECORD END; cma$e_aritherr : RECORD END; cma$e_SIGSYS : RECORD END; cma$e_SIGPIPE : RECORD END; cma$e_excpu : RECORD END; cma$e_exfilsiz : RECORD END; cma$e_intovf : RECORD END; cma$e_intdiv : RECORD END; cma$e_fltovf : RECORD END; cma$e_fltdiv : RECORD END; cma$e_fltund : RECORD END; cma$e_decovf : RECORD END; cma$e_subrng : RECORD END; cma$e_alerted : RECORD END; cma$e_assertion : RECORD END; cma$e_badparam : RECORD END; cma$e_bugcheck : RECORD END; cma$e_exit_thread : RECORD END; cma$e_existence : RECORD END; cma$e_in_use : RECORD END; cma$e_use_error : RECORD END; cma$e_wrongmutex : RECORD END; cma$e_stackovf : RECORD END; cma$e_nostackmem : RECORD END; cma$e_notcmastack : RECORD END; cma$e_unimp : RECORD END; cma$e_inialrpro : RECORD END; cma$e_defer_q_full : RECORD END; cma$e_signal_q_full : RECORD END; cma$e_alert_nesting : RECORD END; (* *) (* Operations on Handles *) (* *) (* *) (* The value of a handle can be assigned the value of another handle. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$handle_assign ( handle1 : cma$t_handle; VAR handle2 : [VOLATILE] cma$t_handle); EXTERNAL; (* *) (* The value of a handle can be assigned the value of another handle. *) (* *) [ASYNCHRONOUS] FUNCTION cma$handle_equal ( handle1 : cma$t_handle; handle2 : cma$t_handle) : cma$t_boolean; EXTERNAL; (* *) (* An attributes object is created to specify the attributes of other CMA *) (* objects that will be created. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_create ( VAR NEW_ATT : [VOLATILE] cma$t_attr; ATTR : cma$t_attr); EXTERNAL; (* *) (* An attributes object can be deleted when it is no longer needed. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_delete ( VAR ATTR : [VOLATILE] cma$t_attr); EXTERNAL; (* *) (* 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. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_create ( VAR new_thread : [VOLATILE] cma$t_thread; ATTR : cma$t_attr; %IMMED [UNBOUND, ASYNCHRONOUS] PROCEDURE START_ROUTINE; ARG : cma$t_address); EXTERNAL; (* *) (* A thread object may be "detached" to specify that the return value and *) (* completion status will not be requested. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_detach ( VAR THREAD : [VOLATILE] cma$t_thread); EXTERNAL; (* *) (* A thread may terminate it's own execution. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_exit_error; EXTERNAL; (* *) (* Exit a thread normally. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_exit_normal ( result : cma$t_address); EXTERNAL; (* *) (* A thread can await termination of another thread and retrieve the return *) (* value and completion status of the thread. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_join ( THREAD : cma$t_thread; VAR EXIT_STATUS : [VOLATILE] cma$t_exit_status; VAR RESULT : [VOLATILE] cma$t_address); EXTERNAL; (* *) (* Operations to define thread creation attributes *) (* *) (* *) (* Set or obtain the default thread priority. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_set_priority ( attr : cma$t_attr; PRIORITY : cma$t_priority); EXTERNAL; (* *) (* Obtain thread priority from attributes object. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_get_priority ( attr : cma$t_attr; VAR PRIORITY : [VOLATILE] cma$t_priority); EXTERNAL; (* *) (* Set or obtain the default scheduling algorithm. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_set_sched ( attr : cma$t_attr; policy : cma$t_sched_policy); EXTERNAL; (* *) (* Get thread scheduling algorithm from attributes object. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_get_sched ( attr : cma$t_attr; VAR POLICY : [VOLATILE] cma$t_sched_policy); EXTERNAL; (* *) (* Set or obtain whether a thread will use the default scheduling attributes, *) (* or inherit them from the creating thread. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_set_inherit_sched ( attr : cma$t_attr; SETTING : cma$t_sched_inherit); EXTERNAL; (* *) (* Obtain default scheduling attributes. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_get_inherit_sched ( attr : cma$t_attr; VAR SETTING : [VOLATILE] cma$t_sched_inherit); EXTERNAL; (* *) (* Set the default stack size *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_set_stacksize ( attr : cma$t_attr; stacksize : cma$t_natural); EXTERNAL; (* *) (* Obtain the default stack size. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_get_stacksize ( attr : cma$t_attr; VAR stacksize : [VOLATILE] cma$t_natural); EXTERNAL; (* *) (* Set the default guard size *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_set_guardsize ( attr : cma$t_attr; guardsize : cma$t_natural); EXTERNAL; (* *) (* Obtain the default guard size *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_get_guardsize ( attr : cma$t_attr; VAR guardsize : [VOLATILE] cma$t_natural); EXTERNAL; (* *) (* Thread Scheduling Operations *) (* *) (* *) (* The current user_assigned priority of a thread can be changed. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_set_priority ( thread : cma$t_thread; priority : cma$t_priority); EXTERNAL; (* *) (* The current user_assigned scheduler algorithm of a thread can be changed. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_set_sched ( thread : cma$t_thread; policy : cma$t_sched_policy); EXTERNAL; (* *) (* A thread may tell the scheduler that its processor can be made available. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$yield; EXTERNAL; (* *) (* A thread may enter a wait state for a specifed period of time. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$delay ( %IMMED interval : cma$t_interval); EXTERNAL; (* *) (* Thread Information Operations *) (* *) (* *) (* A thread may obtain a copy of its own thread handle. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_get_self ( VAR thread : [VOLATILE] cma$t_thread); EXTERNAL; (* *) (* The current user_assigned priority of a thread can be read. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_get_priority ( thread : cma$t_thread; VAR priority : [VOLATILE] cma$t_priority); EXTERNAL; (* *) (* The current user_assigned scheduler algorithm of a thread can be read. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_get_sched ( thread : cma$t_thread; VAR policy : [VOLATILE] cma$t_sched_policy); EXTERNAL; (* *) (* Operations on Mutexes *) (* *) (* *) (* Set whether mutex locks can nest. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_set_mutex_kind ( attr : cma$t_attr; nest : cma$t_mutex_kind); EXTERNAL; (* *) (* Obtain whether mutex locks can nest. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$attr_get_mutex_kind ( attr : cma$t_attr; nest : cma$t_mutex_kind); EXTERNAL; (* *) (* The following routines create, delete, lock and unlock mutexes. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$mutex_create ( VAR new_mutex : [VOLATILE] cma$t_mutex; attr : cma$t_attr); EXTERNAL; (* *) (* Delete a mutex. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$mutex_delete ( VAR mutex : [VOLATILE] cma$t_mutex); EXTERNAL; (* *) (* Lock a mutex. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$mutex_lock ( mutex : cma$t_mutex); EXTERNAL; (* *) (* Try to lock a mutex. *) (* *) [ASYNCHRONOUS] FUNCTION cma$mutex_try_lock ( mutex : cma$t_mutex) : cma$t_boolean; EXTERNAL; (* *) (* Unlock a mutex. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$mutex_unlock ( mutex : cma$t_mutex); EXTERNAL; (* *) (* Lock Global mutex. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$lock_global; EXTERNAL; (* *) (* Unlock Global mutex. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$unlock_global; EXTERNAL; (* *) (* A thread can create and delete condition variables. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$cond_create ( VAR new_condition : [VOLATILE] cma$t_cond; attr : cma$t_attr); EXTERNAL; (* *) (* Delete a condition variable. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$cond_delete ( VAR condition : [VOLATILE] cma$t_cond); EXTERNAL; (* *) (* A thread can signal to and broadcast on a condition variable. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$cond_broadcast ( condition : cma$t_cond); EXTERNAL; (* *) (* Signal a condition variable. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$cond_signal ( condition : cma$t_cond); EXTERNAL; (* *) (* Interupt signal a condition variable. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$cond_signal_int ( condition : cma$t_cond); EXTERNAL; (* *) (* A thread can wait for a condition variable to be signalled or broadcast. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$cond_wait ( condition : cma$t_cond; mutex : cma$t_mutex); EXTERNAL; (* *) (* Operations for timed waiting *) (* *) (* *) (* A thread can perform a timed wait on a condition variable. *) (* *) [ASYNCHRONOUS] FUNCTION cma$cond_timed_wait ( condition : cma$t_cond; mutex : cma$t_mutex; expiration : cma$t_date_time) : cma$t_status; EXTERNAL; (* *) (* A thread may perform some operations on absolute date-time and intervals. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$time_get_expiration ( VAR expiration : [VOLATILE] cma$t_date_time; %IMMED interval : cma$t_interval); EXTERNAL; (* *) (* Operations for CMA and client initialization. *) (* *) (* *) (* Initialize the CMA facility. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$init; EXTERNAL; (* *) (* A thread can declare a one-time initialization routine. The address of *) (* the init block and routine are passed as parameters. *) (* *) TYPE cma$t_init_routine =^$DEFTYP (* entry *); (* *) (* Once routine *) (* *) [ASYNCHRONOUS] PROCEDURE cma$once ( init_block : cma$t_address; init_routine : cma$t_init_routine); EXTERNAL; (* *) (* Operations for per-thread context *) (* *) TYPE cma$t_destructor =^$DEFTYP (* entry *); (* *) (* A unique per-thread context key can be obtained for the process *) (* *) [ASYNCHRONOUS] PROCEDURE cma$key_create ( VAR key : [VOLATILE] cma$t_key; attr : cma$t_attr; destructor : cma$t_destructor); EXTERNAL; (* *) (* A thread can set a per-thread context value identified by a key. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$key_set_context ( key : cma$t_key; context_value : cma$t_address); EXTERNAL; (* *) (* A thread can retrieve a per-thread context value identified by a key. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$key_get_context ( key : cma$t_key; VAR context_value : [VOLATILE] cma$t_address); EXTERNAL; (* *) (* Operations for alerts. *) (* *) (* *) (* The current thread can request that a thread terminate it's execution. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$thread_alert ( thread : cma$t_thread); EXTERNAL; (* *) (* The current thread can poll for alert delivery. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$alert_test; EXTERNAL; (* *) (* Control alert delivery state. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$alert_disable_asynch ( VAR priority : [VOLATILE] cma$t_alert_state); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$alert_disable_general ( VAR priority : [VOLATILE] cma$t_alert_state); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$alert_enable_asynch; EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$alert_enable_general ( VAR priority : [VOLATILE] cma$t_alert_state); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$alert_restore ( priority : cma$t_alert_state); EXTERNAL; (* *) (* Operations on stacks *) (* *) TYPE cma$t_call_routine =^$DEFTYP (* entry *); (* *) (* Assign a stack to a thread *) (* *) [ASYNCHRONOUS] PROCEDURE cma$stack_assign_np ( stack : cma$t_stack_np; thread : cma$t_thread); EXTERNAL; (* *) (* Call a routine on a new stack *) (* *) [ASYNCHRONOUS] PROCEDURE cma$stack_call_routine_np ( stack : cma$t_stack_np; routine : cma$t_call_routine; arg : cma$t_address; VAR result : [VOLATILE] cma$t_address); EXTERNAL; (* *) (* Check stack limit *) (* *) [ASYNCHRONOUS] FUNCTION cma$stack_check_limit_np ( size : cma$t_integer) : cma$t_boolean; EXTERNAL; (* *) (* Create a new stack *) (* *) [ASYNCHRONOUS] PROCEDURE cma$stack_create_np ( VAR stack : [VOLATILE] cma$t_stack_np; attr : cma$t_attr); EXTERNAL; (* *) (* Delete a stack *) (* *) [ASYNCHRONOUS] PROCEDURE cma$stack_delete_np ( VAR stack : [VOLATILE] cma$t_stack_np); EXTERNAL; (* *) (* CMA Debug entry point *) (* *) [ASYNCHRONOUS] PROCEDURE cma$debug; EXTERNAL; (* *) (* Fetch the fp *) (* *) [ASYNCHRONOUS] FUNCTION cma$exc_fetch_fp : cma$t_address; EXTERNAL; (* *) (* Push an exception context *) (* *) [ASYNCHRONOUS] PROCEDURE cma$exc_push_ctx ( cb : cma$t_address); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$exc_pop_ctx ( VAR cb : [VOLATILE] cma$t_address); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$exc_raise ( exc : cma$t_address); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$exc_raise_status ( status : cma$t_integer); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$exc_report ( exc : cma$t_address); EXTERNAL; [ASYNCHRONOUS] FUNCTION cma$exc_handler : cma$t_integer; EXTERNAL; [ASYNCHRONOUS] FUNCTION cma$sigwait ( wset : cma$t_address) : cma$t_integer; EXTERNAL; (************************************************************************** *) (* *) (* The following are the portable CMA High-Level Library definitions *) (* *) (************************************************************************** *) (* *) (* Operations on attributes objects *) (* *) TYPE cma$lib_t_attr = RECORD END; (* *) (* An attributes object is created to specify the attributes of other CMA *) (* objects that will be created. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$lib_attr_create ( VAR NEW_ATTR : [VOLATILE] cma$lib_t_attr; ATTR : cma$lib_t_attr); EXTERNAL; (* *) (* An attributes object can be deleted when it is no longer needed. *) (* *) [ASYNCHRONOUS] PROCEDURE cma$lib_attr_delete ( VAR ATTR : [VOLATILE] cma$lib_t_attr); EXTERNAL; (* *) (* Operations on queues *) (* *) TYPE cma$lib_t_queue = RECORD END; [ASYNCHRONOUS] PROCEDURE cma$lib_queue_create ( VAR NEW_QUEUE : [VOLATILE] cma$lib_t_queue; ATT : cma$lib_t_attr); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$lib_queue_delete ( VAR QUEUE : [VOLATILE] cma$lib_t_queue); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$lib_queue_dequeue ( QUEUE : cma$lib_t_queue; VAR ELEMENT : [VOLATILE] cma$t_address); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$lib_queue_enqueue ( QUEUE : cma$lib_t_queue; %IMMED ELEMENT : cma$t_address); EXTERNAL; [ASYNCHRONOUS] FUNCTION cma$lib_queue_try_enqueue_int ( QUEUE : cma$lib_t_queue; %IMMED ELEMENT : cma$t_address) : cma$t_boolean; EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$lib_queue_requeue ( QUEUE : cma$lib_t_queue; %IMMED ELEMENT : cma$t_address); EXTERNAL; [ASYNCHRONOUS] FUNCTION cma$lib_queue_try_dequeue ( QUEUE : cma$lib_t_queue; VAR ELEMENT : [VOLATILE] cma$t_address) : cma$t_boolean; EXTERNAL; [ASYNCHRONOUS] FUNCTION cma$lib_queue_try_enqueue ( QUEUE : cma$lib_t_queue; %IMMED ELEMENT : cma$t_address) : cma$t_boolean; EXTERNAL; [ASYNCHRONOUS] FUNCTION cma$lib_queue_try_requeue ( QUEUE : cma$lib_t_queue; %IMMED ELEMENT : cma$t_address) : cma$t_boolean; EXTERNAL; (* *) (* Set or obtain the default queue size *) (* *) [ASYNCHRONOUS] PROCEDURE cma$lib_attr_get_queuesize ( ATTR : cma$lib_t_attr; VAR QUEUESIZE : [VOLATILE] cma$t_natural); EXTERNAL; [ASYNCHRONOUS] PROCEDURE cma$lib_attr_set_queuesize ( ATTR : cma$lib_t_attr; %IMMED QUEUESIZE : cma$t_natural); EXTERNAL; (* END. *) END.