TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Alan and Carmel Brain <[log in to unmask]>
Reply To:
Alan and Carmel Brain <[log in to unmask]>
Mon, 1 Mar 2004 23:49:54 +1100
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.