comp.lang.ada
 help / color / mirror / Atom feed
From: robert_dewar@my-dejanews.com
Subject: Re: Imported Monolitic Monitor
Date: 1999/03/08
Date: 1999-03-08T00:00:00+00:00	[thread overview]
Message-ID: <7c0kvm$1ar$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 7bv4jv$7om$1@plug.news.pipex.net

In article <7bv4jv$7om$1@plug.news.pipex.net>,
  "Nick Roberts" <Nick.Roberts@dial.pipex.com> wrote:
> Two further small matters.  Firstly, "yup" means "yes".
> Secondly, if any of the C functions (a, b, or c) only
> reads the global data (but does not change it), make it
> be called by a 'function' in Ada (inside the protected
> object), rather than a 'procedure'.  This may execute
> slightly more efficiently (because it will allow multiple
> tasks to read the data at the same time).

The "will" here is wrong, the right verb is "may". In fact
we have found that most operating systems lack the
primitives to allow simultaneous reading, so usually in
GNAT, functions do not permit this kind of access, and
they use a mutual exclusion lock identical to the lock
used for procedures (as of course permitted by the RM).
Yes, you could rig up a higher level layer allowing this
synchronization, but given the usual expectation of
protected subprograms being short, this would probably
increase overhead rather than decrease it.

In any case, I suggest programmers choose between
procedures and functions in this situation on the basis
of which is the better abstraction. Worrying about low
level implementation details is not the way to create
pleasant interfaces!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




      reply	other threads:[~1999-03-08  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-05  0:00 Imported Monolitic Monitor Juan Carlos Díaz Martín
1999-03-05  0:00 ` dennison
1999-03-07  0:00   ` Nick Roberts
1999-03-08  0:00     ` robert_dewar [this message]
replies disabled

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