----- 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


Hi,

>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
deadlock.

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
problem.

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.