From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: Re: Naming convention to identify functions with side effects
Date: Fri, 03 Oct 2008 11:18:39 +0200
Date: 2008-10-03T11:18:40+02:00 [thread overview]
Message-ID: <48e5e370$0$6615$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <wvbrtzbvgorn.fsf@sun.com>
Ole-Hjalmar Kristensen wrote:
> How would you implement the lock in youre case? I prefer not to mess
> around with semaphores, but use protected objects instead. In that
> case keeping the lock across the two calls is not so trivial.
In a simple, maybe simplistic way I'd hide the lock.
package News26 is
subtype URL is String;
type Web_Resource is tagged limited private;
-- ... Observe the calling protocol, which is
-- Load -> Is_Loaded -> Discard
function Is_Loaded (Page: Web_Resource) return Boolean;
procedure Load (Page: in out Web_Resource; Location: URL);
procedure Discard (Page: in out Web_Resource);
private
protected type Resource is
entry Seize;
procedure Release;
private
Busy: Boolean := False;
end Resource;
type Web_Resource is tagged limited
record
Lock: Resource;
-- ...
end record;
end News26;
Procedure Load will then Seize the Lock.
Another scheme could, I think, be using Dmitry's Page_Cache
administrating the sequencing of calls by slot-wise locking
or some such.
next prev parent reply other threads:[~2008-10-03 9:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-29 18:17 Naming convention to identify functions with side effects Hibou57 (Yannick Duchêne)
2008-09-29 18:45 ` Hibou57 (Yannick Duchêne)
2008-09-29 18:55 ` Adam Beneschan
2008-09-29 19:52 ` Dmitry A. Kazakov
2008-09-29 20:48 ` Georg Bauhaus
2008-09-29 21:10 ` Adam Beneschan
2008-09-30 15:17 ` Georg Bauhaus
2008-09-30 17:40 ` Ray Blaak
2008-10-02 12:33 ` Ole-Hjalmar Kristensen
2008-10-03 9:18 ` Georg Bauhaus [this message]
2008-10-06 7:24 ` Ole-Hjalmar Kristensen
2008-10-03 11:51 ` Brian Drummond
2008-10-03 12:28 ` Dmitry A. Kazakov
2008-10-04 12:30 ` Marco
2008-10-04 13:05 ` (see below)
2008-10-04 15:14 ` Gary Scott
2008-10-11 11:32 ` Marco
2008-10-11 14:57 ` Dmitry A. Kazakov
2008-10-11 16:05 ` (see below)
2008-10-11 17:49 ` Georg Bauhaus
2008-10-11 18:42 ` (see below)
2008-10-03 13:15 ` Jeffrey Creem
2008-09-29 20:57 ` Georg Bauhaus
2008-09-29 22:22 ` Dr. Adrian Wrigley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox