!*** MODULE CMA$DEF IDENT V3.15-001 *** !DEC$ OPTIONS/ALIGN=(RECORDS=PACKED,COMMONS=PACKED)/NOWARN ! ! 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. ! PARAMETER DECTHREADS_ = '00000001'X ! ** INTEGER*4 cma$t_integer ! ** INTEGER*4 cma$t_boolean ! ** INTEGER*4 cma$t_natural ! ** REAL*4 cma$t_interval ! ** INTEGER*4 cma$t_key ! ** INTEGER*4 cma$t_status ! ** INTEGER*4 cma$t_priority ! ** INTEGER*4 cma$t_address PARAMETER cma$c_prio_fifo_min = '00000010'X PARAMETER cma$c_prio_fifo_mid = '00000018'X PARAMETER cma$c_prio_fifo_max = '0000001F'X PARAMETER cma$c_prio_rr_min = '00000010'X PARAMETER cma$c_prio_rr_mid = '00000018'X PARAMETER cma$c_prio_rr_max = '0000001F'X PARAMETER cma$c_prio_through_min = '00000008'X PARAMETER cma$c_prio_through_mid = '0000000C'X PARAMETER cma$c_prio_through_max = '0000000F'X PARAMETER cma$c_prio_back_min = '00000000'X PARAMETER cma$c_prio_back_mid = '00000004'X PARAMETER cma$c_prio_back_max = '00000007'X PARAMETER cma$c_prio_ada_low_min = '00000000'X PARAMETER cma$c_prio_ada_low_mid = '00000004'X PARAMETER cma$c_prio_ada_low_max = '00000007'X PARAMETER cma$c_prio_ada_rtb_min = '00000000'X PARAMETER cma$c_prio_ada_rtb_mid = '00000004'X PARAMETER cma$c_prio_ada_rtb_max = '00000007'X ! ! 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. ! STRUCTURE /cma$t_date_time/ INTEGER*4 low INTEGER*4 high END STRUCTURE ! cma$t_date_time ! ! Sample decisions for what handles shall be ! STRUCTURE /cma$t_handle/ INTEGER*4 handle_field1 ! type is "cma$t_natural" INTEGER*4 handle_field2 ! type is "cma$t_natural" END STRUCTURE ! cma$t_handle PARAMETER cma$c_handle_size = '00000008'X ! ! Sample decision for a one-time initialization control block and its ! initialization macro. ! ! STRUCTURE /cma$t_once/ INTEGER*4 once_field1 ! type is "cma$t_integer" INTEGER*4 once_field2 ! type is "cma$t_integer" INTEGER*4 once_field3 ! type is "cma$t_integer" END STRUCTURE ! cma$t_once ! ! Sample decision for a variable to save the current alert state. ! STRUCTURE /cma$t_alert_state/ INTEGER*4 state1 ! type is "cma$t_integer" INTEGER*4 state2 ! type is "cma$t_integer" END STRUCTURE ! cma$t_alert_state ! ! The following are the portable CMA definitions ! ! ! Operations on threads ! ! ** INTEGER*4 cma$t_start_routine ! ! Constants ! PARAMETER cma$c_false = '00000000'X PARAMETER cma$c_true = '00000001'X PARAMETER cma$c_null_ptr = '00000000'X ! ! Objects ! STRUCTURE /cma$t_mutex/ ! Needed for ONCE_BLOCK INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$t_mutex STRUCTURE /cma$t_attr/ INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$t_attr STRUCTURE /cma$t_thread/ INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$t_thread STRUCTURE /cma$t_cond/ INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$t_cond STRUCTURE /cma$t_stack_np/ INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$t_stack_np ! ! Exit status constants ! ! ** INTEGER*4 cma$t_exit_status PARAMETER cma$c_term_error = '00000000'X PARAMETER cma$c_term_normal = '00000001'X PARAMETER cma$c_term_alert = '00000002'X PARAMETER cma$c_null_thread = -1 ! ! Schedule inheritance constants ! ! ** INTEGER*4 cma$t_sched_inherit PARAMETER cma$c_sched_inherit = '00000000'X PARAMETER cma$c_sched_use_default = '00000001'X ! ! Schedule policy constants ! ! ** INTEGER*4 cma$t_sched_policy PARAMETER cma$c_sched_fifo = '00000000'X PARAMETER cma$c_sched_rr = '00000001'X PARAMETER cma$c_sched_throughput = '00000002'X PARAMETER cma$c_sched_background = '00000003'X PARAMETER cma$c_sched_ada_low = '00000004'X ! ! Default and other policies. ! PARAMETER cma$c_sched_default = '00000002'X PARAMETER cma$c_sched_other = '00000002'X ! ! Mutex types ! ! ** INTEGER*4 cma$t_mutex_kind PARAMETER cma$c_mutex_fast = '00000000'X PARAMETER cma$c_mutex_recursive = '00000001'X PARAMETER cma$c_mutex_nonrecursive = '00000002'X ! ! 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 ! PARAMETER cma$_exception = '0040800C'X PARAMETER cma$_exccop = '00408014'X PARAMETER cma$_uninitexc = '0040801C'X PARAMETER cma$_unkstatus = '00408404'X PARAMETER cma$_exccoplos = '0040840C'X PARAMETER cma$_illaddr = '0000000C'X PARAMETER cma$_exquota = '0000001C'X PARAMETER cma$_insfmem = '00000124'X PARAMETER cma$_nopriv = '00000024'X PARAMETER cma$_normal = '00000001'X PARAMETER cma$_illinstr = '0000043C'X PARAMETER cma$_resaddr = '0000044C'X PARAMETER cma$_privinst = '0000043C'X PARAMETER cma$_resoper = '00000454'X PARAMETER cma$_SIGTRAP = '00000414'X PARAMETER cma$_SIGIOT = '0000002C'X PARAMETER cma$_SIGEMT = '0000042C'X PARAMETER cma$_aritherr = '0000048C'X PARAMETER cma$_SIGSYS = '00000014'X PARAMETER cma$_SIGPIPE = '00000274'X PARAMETER cma$_excpu = '000020AC'X PARAMETER cma$_exfilsiz = '000003EC'X PARAMETER cma$_intovf = '0000047C'X PARAMETER cma$_intdiv = '00000484'X PARAMETER cma$_fltovf = '0000048C'X PARAMETER cma$_fltdiv = '00000494'X PARAMETER cma$_fltund = '0000049C'X PARAMETER cma$_decovf = '000004A4'X PARAMETER cma$_subrng = '000004AC'X PARAMETER cma$_accvio = '0000000C'X PARAMETER cma$_SIGILL = '0000043C'X PARAMETER cma$_SIGFPE = '0000048C'X PARAMETER cma$_SIGBUS = '0000043C'X PARAMETER cma$_SIGSEGV = '0000043C'X PARAMETER cma$_SIGXCPU = '000020AC'X PARAMETER cma$_SIGXFSZ = '000003EC'X PARAMETER cma$_alerted = '00408184'X PARAMETER cma$_assertion = '0040818C'X PARAMETER cma$_badparam = '00408194'X PARAMETER cma$_bugcheck = '0040819C'X PARAMETER cma$_exit_thread = '004081A4'X PARAMETER cma$_existence = '004081AC'X PARAMETER cma$_in_use = '004081B4'X PARAMETER cma$_use_error = '004081BC'X PARAMETER cma$_wrongmutex = '004081C4'X PARAMETER cma$_stackovf = '0000022A'X PARAMETER cma$_nostackmem = '004081D4'X PARAMETER cma$_notcmastack = '004081DC'X PARAMETER cma$_timed_out = '004081E4'X PARAMETER cma$_unimp = '004081EC'X PARAMETER cma$_inialrpro = '004081F4'X PARAMETER cma$_defer_q_full = '004081FC'X PARAMETER cma$_signal_q_full = '00408204'X PARAMETER cma$_alert_nesting = '0040820C'X ! ! EXCEPTION TYPE DEFINITIONS ! ! ** INTEGER*4 cma$exc_address_t ! ** INTEGER*4 cma$exc_kind_t ! ** INTEGER*4 cma$exc_int_t ! ! Internal contents of an exception object. ! STRUCTURE /cma$t_exception/ INTEGER*4 exc_kind ! type is "cma$exc_kind_t" INTEGER*4 exc_info ! type is "cma$exc_address_t" INTEGER*4 exc_filler(1:6) ! type is "cma$exc_address_t" END STRUCTURE ! cma$t_exception RECORD /cma$t_exception/ cma$e_uninitexc RECORD /cma$t_exception/ cma$e_illaddr RECORD /cma$t_exception/ cma$e_exquota RECORD /cma$t_exception/ cma$e_insfmem RECORD /cma$t_exception/ cma$e_nopriv RECORD /cma$t_exception/ cma$e_illinstr RECORD /cma$t_exception/ cma$e_resaddr RECORD /cma$t_exception/ cma$e_privinst RECORD /cma$t_exception/ cma$e_resoper RECORD /cma$t_exception/ cma$e_SIGTRAP RECORD /cma$t_exception/ cma$e_SIGIOT RECORD /cma$t_exception/ cma$e_SIGEMT RECORD /cma$t_exception/ cma$e_aritherr RECORD /cma$t_exception/ cma$e_SIGSYS RECORD /cma$t_exception/ cma$e_SIGPIPE RECORD /cma$t_exception/ cma$e_excpu RECORD /cma$t_exception/ cma$e_exfilsiz RECORD /cma$t_exception/ cma$e_intovf RECORD /cma$t_exception/ cma$e_intdiv RECORD /cma$t_exception/ cma$e_fltovf RECORD /cma$t_exception/ cma$e_fltdiv RECORD /cma$t_exception/ cma$e_fltund RECORD /cma$t_exception/ cma$e_decovf RECORD /cma$t_exception/ cma$e_subrng RECORD /cma$t_exception/ cma$e_alerted RECORD /cma$t_exception/ cma$e_assertion RECORD /cma$t_exception/ cma$e_badparam RECORD /cma$t_exception/ cma$e_bugcheck RECORD /cma$t_exception/ cma$e_exit_thread RECORD /cma$t_exception/ cma$e_existence RECORD /cma$t_exception/ cma$e_in_use RECORD /cma$t_exception/ cma$e_use_error RECORD /cma$t_exception/ cma$e_wrongmutex RECORD /cma$t_exception/ cma$e_stackovf RECORD /cma$t_exception/ cma$e_nostackmem RECORD /cma$t_exception/ cma$e_notcmastack RECORD /cma$t_exception/ cma$e_unimp RECORD /cma$t_exception/ cma$e_inialrpro RECORD /cma$t_exception/ cma$e_defer_q_full RECORD /cma$t_exception/ cma$e_signal_q_full RECORD /cma$t_exception/ cma$e_alert_nesting ! ! Operations on Handles ! ! ! The value of a handle can be assigned the value of another handle. ! ! Subroutine cma$handle_assign ! ! The value of a handle can be assigned the value of another handle. ! INTEGER*4 cma$handle_equal ! type is "cma$t_boolean" EXTERNAL cma$handle_equal ! ! An attributes object is created to specify the attributes of other CMA ! objects that will be created. ! ! Subroutine cma$attr_create ! ! An attributes object can be deleted when it is no longer needed. ! ! Subroutine 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. ! ! Subroutine cma$thread_create ! ! A thread object may be "detached" to specify that the return value and ! completion status will not be requested. ! ! Subroutine cma$thread_detach ! ! A thread may terminate it's own execution. ! ! Subroutine cma$thread_exit_error ! ! Exit a thread normally. ! ! Subroutine cma$thread_exit_normal ! ! A thread can await termination of another thread and retrieve the return ! value and completion status of the thread. ! ! Subroutine cma$thread_join ! ! Operations to define thread creation attributes ! ! ! Set or obtain the default thread priority. ! ! Subroutine cma$attr_set_priority ! ! Obtain thread priority from attributes object. ! ! Subroutine cma$attr_get_priority ! ! Set or obtain the default scheduling algorithm. ! ! Subroutine cma$attr_set_sched ! ! Get thread scheduling algorithm from attributes object. ! ! Subroutine cma$attr_get_sched ! ! Set or obtain whether a thread will use the default scheduling attributes, ! or inherit them from the creating thread. ! ! Subroutine cma$attr_set_inherit_sched ! ! Obtain default scheduling attributes. ! ! Subroutine cma$attr_get_inherit_sched ! ! Set the default stack size ! ! Subroutine cma$attr_set_stacksize ! ! Obtain the default stack size. ! ! Subroutine cma$attr_get_stacksize ! ! Set the default guard size ! ! Subroutine cma$attr_set_guardsize ! ! Obtain the default guard size ! ! Subroutine cma$attr_get_guardsize ! ! Thread Scheduling Operations ! ! ! The current user_assigned priority of a thread can be changed. ! ! Subroutine cma$thread_set_priority ! ! The current user_assigned scheduler algorithm of a thread can be changed. ! ! Subroutine cma$thread_set_sched ! ! A thread may tell the scheduler that its processor can be made available. ! ! Subroutine cma$yield ! ! A thread may enter a wait state for a specifed period of time. ! ! Subroutine cma$delay ! ! Thread Information Operations ! ! ! A thread may obtain a copy of its own thread handle. ! ! Subroutine cma$thread_get_self ! ! The current user_assigned priority of a thread can be read. ! ! Subroutine cma$thread_get_priority ! ! The current user_assigned scheduler algorithm of a thread can be read. ! ! Subroutine cma$thread_get_sched ! ! Operations on Mutexes ! ! ! Set whether mutex locks can nest. ! ! Subroutine cma$attr_set_mutex_kind ! ! Obtain whether mutex locks can nest. ! ! Subroutine cma$attr_get_mutex_kind ! ! The following routines create, delete, lock and unlock mutexes. ! ! Subroutine cma$mutex_create ! ! Delete a mutex. ! ! Subroutine cma$mutex_delete ! ! Lock a mutex. ! ! Subroutine cma$mutex_lock ! ! Try to lock a mutex. ! INTEGER*4 cma$mutex_try_lock ! type is "cma$t_boolean" EXTERNAL cma$mutex_try_lock ! ! Unlock a mutex. ! ! Subroutine cma$mutex_unlock ! ! Lock Global mutex. ! ! Subroutine cma$lock_global ! ! Unlock Global mutex. ! ! Subroutine cma$unlock_global ! ! A thread can create and delete condition variables. ! ! Subroutine cma$cond_create ! ! Delete a condition variable. ! ! Subroutine cma$cond_delete ! ! A thread can signal to and broadcast on a condition variable. ! ! Subroutine cma$cond_broadcast ! ! Signal a condition variable. ! ! Subroutine cma$cond_signal ! ! Interupt signal a condition variable. ! ! Subroutine cma$cond_signal_int ! ! A thread can wait for a condition variable to be signalled or broadcast. ! ! Subroutine cma$cond_wait ! ! Operations for timed waiting ! ! ! A thread can perform a timed wait on a condition variable. ! INTEGER*4 cma$cond_timed_wait ! type is "cma$t_status" EXTERNAL cma$cond_timed_wait ! ! A thread may perform some operations on absolute date-time and intervals. ! ! Subroutine cma$time_get_expiration ! ! Operations for CMA and client initialization. ! ! ! Initialize the CMA facility. ! ! Subroutine cma$init ! ! A thread can declare a one-time initialization routine. The address of ! the init block and routine are passed as parameters. ! ! ** INTEGER*4 cma$t_init_routine ! ! Once routine ! ! Subroutine cma$once ! ! Operations for per-thread context ! ! ** INTEGER*4 cma$t_destructor ! ! A unique per-thread context key can be obtained for the process ! ! Subroutine cma$key_create ! ! A thread can set a per-thread context value identified by a key. ! ! Subroutine cma$key_set_context ! ! A thread can retrieve a per-thread context value identified by a key. ! ! Subroutine cma$key_get_context ! ! Operations for alerts. ! ! ! The current thread can request that a thread terminate it's execution. ! ! Subroutine cma$thread_alert ! ! The current thread can poll for alert delivery. ! ! Subroutine cma$alert_test ! ! Control alert delivery state. ! ! Subroutine cma$alert_disable_asynch ! Subroutine cma$alert_disable_general ! Subroutine cma$alert_enable_asynch ! Subroutine cma$alert_enable_general ! Subroutine cma$alert_restore ! ! Operations on stacks ! ! ** INTEGER*4 cma$t_call_routine ! ! Assign a stack to a thread ! ! Subroutine cma$stack_assign_np ! ! Call a routine on a new stack ! ! Subroutine cma$stack_call_routine_np ! ! Check stack limit ! INTEGER*4 cma$stack_check_limit_np ! type is "cma$t_boolean" EXTERNAL cma$stack_check_limit_np ! ! Create a new stack ! ! Subroutine cma$stack_create_np ! ! Delete a stack ! ! Subroutine cma$stack_delete_np ! ! CMA Debug entry point ! ! Subroutine cma$debug ! ! Fetch the fp ! INTEGER*4 cma$exc_fetch_fp ! type is "cma$t_address" EXTERNAL cma$exc_fetch_fp ! ! Push an exception context ! ! Subroutine cma$exc_push_ctx ! Subroutine cma$exc_pop_ctx ! Subroutine cma$exc_raise ! Subroutine cma$exc_raise_status ! Subroutine cma$exc_report INTEGER*4 cma$exc_handler ! type is "cma$t_integer" EXTERNAL cma$exc_handler INTEGER*4 cma$sigwait ! type is "cma$t_integer" EXTERNAL cma$sigwait ! ! The following are the portable CMA High-Level Library definitions ! ! ! Operations on attributes objects ! STRUCTURE /cma$lib_t_attr/ INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$lib_t_attr ! ! An attributes object is created to specify the attributes of other CMA ! objects that will be created. ! ! Subroutine cma$lib_attr_create ! ! An attributes object can be deleted when it is no longer needed. ! ! Subroutine cma$lib_attr_delete ! ! Operations on queues ! STRUCTURE /cma$lib_t_queue/ INTEGER*4 field1 ! type is "cma$t_address" INTEGER*2 field2 INTEGER*2 field3 END STRUCTURE ! cma$lib_t_queue ! Subroutine cma$lib_queue_create ! Subroutine cma$lib_queue_delete ! Subroutine cma$lib_queue_dequeue ! Subroutine cma$lib_queue_enqueue INTEGER*4 cma$lib_queue_try_enqueue_int ! type is "cma$t_boolean" EXTERNAL cma$lib_queue_try_enqueue_int ! Subroutine cma$lib_queue_requeue INTEGER*4 cma$lib_queue_try_dequeue ! type is "cma$t_boolean" EXTERNAL cma$lib_queue_try_dequeue INTEGER*4 cma$lib_queue_try_enqueue ! type is "cma$t_boolean" EXTERNAL cma$lib_queue_try_enqueue INTEGER*4 cma$lib_queue_try_requeue ! type is "cma$t_boolean" EXTERNAL cma$lib_queue_try_requeue ! ! Set or obtain the default queue size ! ! Subroutine cma$lib_attr_get_queuesize ! Subroutine cma$lib_attr_set_queuesize !DEC$ END OPTIONS