TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date: Mon, 1 Mar 2004 23:49:54 +1100
Reply-To: Alan and Carmel Brain <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="iso-8859-1"
From: Alan and Carmel Brain <[log in to unmask]>
Parts/Attachments: text/plain (32 lines)
----- Original Message -----
From: <[log in to unmask]>
To: <[log in to unmask]>
Sent: Monday, March 01, 2004 5:14 PM
Subject: Ada Tasks accessing a protected object


>Could anybody help me with a tasking problem I am experiencing in ADA?

>I have a protected object (PO), and when a single task accesses this PO,
then everything is fine.
>As soon as I have more then one task trying to access the PO, the software
hangs as soon as the 2nd task trys to gain access.

>What could cause this to happen?

The most likely thing is that the first task never releases the PO.
The second task therefore is blocked. This should cause the first task
to continue, but if it's waiting for the second task to do something,
ie waiting for a resource blocked by the second task, then you have a

What code are you using? What compiler? Gnat 13+ handles POs quite well
in my experience, so if you're using Gnat, it's unlikely that it's a compiler

To state the obvious, Judicious use of PUT_LINEs on acquisition and release
entries of the PO will probably reveal the cause. Of course, a Debugger would
be better, but isn't neccessary.