* Re: Alsys Ada 83 to Green Hills Ada 95: ARTK Resource Manager
[not found] <1rUZOBNgrjUOCSMI4WnzEyyo2oMj@4ax.com>
@ 1999-10-29 0:00 ` DuckE
0 siblings, 0 replies; only message in thread
From: DuckE @ 1999-10-29 0:00 UTC (permalink / raw)
I believe what you're looking for is offered by Ada 95 protected types.
Here is a small example of a protected type that implements a mutual
exclusion semaphore:
PROTECTED TYPE aMutex IS
ENTRY LockMutex;
PROCEDURE UnlockMutex;
PRIVATE
isLocked : BOOLEAN := FALSE;
END aMutex;
PROTECTED BODY aMutex IS
ENTRY LockMutex WHEN NOT isLocked IS
BEGIN
isLocked := TRUE;
END LockMutex;
PROCEDURE UnlockMutex IS
BEGIN
isLocked := FALSE;
END UnlockMutex;
END aMutex;
To create an instance of the protected type:
SPIO2_RESOURCE_LOCK : aMutex;
...
To obtain exclusive access to the resource:
SPIO2_RESOURCE_LOCK.LockMutex;
To release the resource:
SPIO2_RESOURCE_LOCK.UnlockMutex;
I hope this helps,
SteveD
Robert Kershaw, KG4ASZ <NOSPAM_kg4asz@arrl.net> wrote in message
news:1rUZOBNgrjUOCSMI4WnzEyyo2oMj@4ax.com...
> I need to update an Ada applications which was written using the Alsys
> Ada 83 compiler to now use the Green Hill's AdaMULTI product and
> WindRiver's VxWorks.
>
> The code has call to the Alsys's ARTK for resource management.
> Example, calls are:
>
> with ARTK;
>
> package EXAMPLE is
>
> -- Set up analog resource so that only one task can call analog
> routines
> -- at a time
> ANALOG_RESOURCE : ARTK.RESOURCES.RESOURCE;
>
> ...
>
>
> Then later on when a resource is needed it uses the resource as shown
> here:
>
> -- Start resource protection
> SPIO2_READY := ARTK.RESOURCES.GET_RESOURCE
> (SPIO2_RESOURCE);
>
>
> ....
>
> -- Release resource protection
> ARTK.RESOURCES.FREE_RESOURCE (SPIO2_RESOURCE);
>
>
> How do I implement these same functions in Ada95?
>
> Does the AdaMULTI or VxWorks have equivalent functions?
>
> Does anyone have Alsys documentation on what these functions do?
>
> Thank You for your help,
>
> RSK
>
>
> ---------------------------------------------------
> NOSPAM_KG4ASZ@arrl.net
> Delete obvious anti-spam garbage from the address (if present) for proper
reply address.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-10-29 0:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1rUZOBNgrjUOCSMI4WnzEyyo2oMj@4ax.com>
1999-10-29 0:00 ` Alsys Ada 83 to Green Hills Ada 95: ARTK Resource Manager DuckE
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox