TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional 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
Subject:
From:
Alan and Carmel Brain <[log in to unmask]>
Reply To:
Alan and Carmel Brain <[log in to unmask]>
Date:
Mon, 1 Mar 2004 23:49:54 +1100
Content-Type:
text/plain
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


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.

ATOM RSS1 RSS2