comp.lang.ada
 help / color / mirror / Atom feed
From: "Keith Allan Shillington" <keith@sd.aonix.com>
Subject: Re: File/Record locking in Ada
Date: 1997/02/28
Date: 1997-02-28T00:00:00+00:00	[thread overview]
Message-ID: <01bc259a$a035e850$fc00af88@godiva> (raw)
In-Reply-To: 3313101D.1BBF@aston.ac.uk


Hmmm.  That would be a protected type.

protected type Record_Lock is
  entry Lock;
  procedure Unlock;
private
  Locked : Boolean := False;
end Record_Lock;

protected body Record_Lock is
  entry Lock when not Locked is
  begin
    Locked := True;
  end Lock;
  procedure Unlock is
  begin
    Locked := False;
  end Unlock;
end Record_Lock;

(as in 9.4(26-29) RM95)

You can add complexity to your hearts content, but this is a single path
regardless of the number of tasks that interact with it.  Dijkstras rules on
semaphores apply.

Stephen Godwin <godwinsp@aston.ac.uk> wrote in article
<3313101D.1BBF@aston.ac.uk>...
> Does anyone know of a record locking method I can use in Ada?
> I've tried using the Forest(POSIX) libraries but can't get them to
> compile under Solaris.
> 
> Thanks,
> 
> Stephen Godwin
> 




  reply	other threads:[~1997-02-28  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-25  0:00 File/Record locking in Ada Stephen Godwin
1997-02-28  0:00 ` Keith Allan Shillington [this message]
1997-03-01  0:00   ` Keith Thompson
1997-03-03  0:00   ` David Emery
1997-03-03  0:00     ` Larry Kilgallen
1997-03-05  0:00   ` David Emery
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox