  PROCEDURE [INLINE] osp$clear_mainframe_sig_lock
    (VAR lock: ost$signature_lock);

?? PUSH (LISTEXT := ON) ??
*copyc clc$compiling_for_test_harness
*copyc fsc$compiling_for_test_harness
*copyc sfc$compiling_for_test_harness

    ?IF NOT (clc$compiling_for_test_harness OR fsc$compiling_for_test_harness OR
          sfc$compiling_for_test_harness) THEN

      VAR
        task_id: ost$global_task_id,
        xcb_p: ^ost$execution_control_block,
        actual_value: integer,
        initial_value: integer,
        cs_status: 0 .. 2;

      xcb_p := #ADDRESS (1, osc$segnum_job_fixed_heap,
            #READ_REGISTER (osc$pr_base_constant));
      task_id := xcb_p^.global_task_id;
      initial_value := task_id.index * 256 * #SIZE (task_id.seqno) + task_id.
            seqno;
      REPEAT
        #COMPARE_SWAP (lock.lock_id, initial_value, 0, actual_value,
              cs_status);
      UNTIL cs_status <> osc$cs_variable_locked;
      IF cs_status <> osc$cs_successful THEN
        osp$system_error ('LOCKMGR - not locked', NIL);
      IFEND;

{ Debug code.

      IF xcb_p^.system_table_lock_count < 256 THEN
        osp$system_error ('LOCKMGR - system_table_lock_count error', NIL);
      IFEND;

{ End debug code.

      xcb_p^.system_table_lock_count := xcb_p^.system_table_lock_count - 256;

{ Check for escaped allocation. If allocation occured while tables were locked,
{ process the allocation.

      IF xcb_p^.stlc_allocation AND (xcb_p^.system_table_lock_count < 256) THEN
        xcb_p^.stlc_allocation := FALSE;
        osp$mfh_for_segment_manager;
      IFEND;

      IF (xcb_p^.system_table_lock_count <= 0) AND (xcb_p^.system_give_up_cpu) THEN
        syp$cycle_for_lock (tmc$cyc_clear_sys_lock, ^lock);
      IFEND;
    ?ELSE
      IF lock.lock_id <> 12 THEN
        osp$system_error (' lock not set', NIL);
      IFEND;
      lock.lock_id := 0;
    ?IFEND

  PROCEND osp$clear_mainframe_sig_lock;
*copyc osp$mfh_for_segment_manager
*copyc ost$execution_control_block
*copyc syp$cycle_for_lock
*copyc ost$heap
*copyc osc$processor_defined_registers
*copyc ost$signature_lock
*copyc osp$system_error
?? POP ??
