|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T V
Length: 4401 (0x1131)
Types: TextFile
Names: »V«
└─⟦516dceb10⟧ Bits:30000751 8mm tape, Rational 1000, RCI_VADS
└─⟦9a14c9417⟧ »DATA«
└─⟦this⟧
-- Copyright 1988 Verdix Corporation
------------------------------------------------------------------------------
-- User interface to the counting semaphore data structures and subprograms
------------------------------------------------------------------------------
WITH V_I_Types;
WITH V_I_Sema;
WITH System;
USE System;
PACKAGE V_I_Csema IS
PRAGMA Suppress (All_Checks);
PRAGMA Suppress (Exception_Tables);
PRAGMA Not_Elaborated;
SUBTYPE Semaphore_Rec IS V_I_Sema.Semaphore_Rec;
SUBTYPE Intr_Status_T IS V_I_Types.Intr_Status_T;
Disable_Intr_Status : CONSTANT Intr_Status_T :=
V_I_Types.Disable_Intr_Status;
-- Predefined wait_time values
Wait_Forever : CONSTANT Duration := -1.0;
Do_Not_Wait : CONSTANT Duration := 0.0;
--------------------------------------------------------------------------
-- Counting semaphore data structure
--------------------------------------------------------------------------
TYPE Cnt_Sema_Record_T IS
RECORD
Enter_S : Semaphore_Rec;
Wait_S : Semaphore_Rec;
Resume_Entry : System.Address;
Intr_Flag : Boolean;
Intr_Status : Intr_Status_T;
Count : Integer;
Deleted_Flag : Boolean;
END RECORD;
TYPE A_Cnt_Sema_T IS ACCESS Cnt_Sema_Record_T;
--------------------------------------------------------------------------
-- Create a new counting semaphore.
--
-- Normally, the critical region for updating the semaphore's
-- count is protected by a binary semaphore.
--
-- However, if the intr_flag is TRUE, then,
-- its critical region is protected by disabling interrupts. This
-- allows the counting semaphore to be accessed from an ISR.
--
-- STORAGE_ERROR exception is raised if not enough memory for semaphore.
--------------------------------------------------------------------------
FUNCTION Create (Initial_Count : Integer := 1;
Intr_Flag : Boolean := False;
Intr_Status : Intr_Status_T := Disable_Intr_Status)
RETURN A_Cnt_Sema_T;
--------------------------------------------------------------------------
-- Deletes a previously created counting semaphore. Returns TRUE if
-- deletion was successful.
--
-- If conditional_delete_flag parameter is TRUE, then, semaphore
-- is not deleted if any task is waiting on it.
-- Otherwise, semaphore is always deleted and waiting tasks
-- are resumed.
--------------------------------------------------------------------------
FUNCTION Delete (Cnt_Sema : A_Cnt_Sema_T; Conditional_Delete_Flag : Boolean)
RETURN Boolean;
--------------------------------------------------------------------------
-- Waits on a counting semaphore.
--
-- Returns TRUE, if semaphore count > 0. The count is decremented
-- before returning.
--
-- If count <= 0, then, returns according to the wait_time parameter:
-- < 0.0 - returns when count > 0. This may necessitate
-- suspension of current task until another task
-- signals.
-- = 0.0 - returns FALSE immediately if count <= 0.
-- > 0.0 - if count doesn't become positive
-- within "wait_time" amount of time, returns FALSE.
--
-- Note: returns FALSE for any wait_time, if semaphore was deleted.
--
--------------------------------------------------------------------------
FUNCTION Wait (Cnt_Sema : A_Cnt_Sema_T; Wait_Time : Duration)
RETURN Boolean;
--------------------------------------------------------------------------
-- Signals a counting semaphore.
--
-- Increments the semphore's count. If count > 0, resumes next
-- task waiting on semaphore.
--------------------------------------------------------------------------
PROCEDURE Signal (Cnt_Sema : A_Cnt_Sema_T);
PRIVATE
PRAGMA Interface (Ada, Create);
PRAGMA Interface_Name (Create, "__CREATE_COUNT_SEMAPHORE");
PRAGMA Interface (Ada, Delete);
PRAGMA Interface_Name (Delete, "__DELETE_COUNT_SEMAPHORE");
PRAGMA Interface (Ada, Wait);
PRAGMA Interface_Name (Wait, "__WAIT_COUNT_SEMAPHORE");
PRAGMA Interface (Ada, Signal);
PRAGMA Interface_Name (Signal, "__SIGNAL_COUNT_SEMAPHORE");
END V_I_Csema;