comp.lang.ada
 help / color / mirror / Atom feed
From: Anh Vo <anhvofrcaus@gmail.com>
Subject: Abstraction - How detail should it be
Date: Mon, 08 Oct 2007 23:23:49 -0000
Date: 2007-10-08T23:23:49+00:00	[thread overview]
Message-ID: <1191885829.472181.229950@50g2000hsm.googlegroups.com> (raw)

I have been reading "Concurrent and Real-Time Programming in Ada" by
Alan Burns and Andy Wellings. By the way, I ordered it about little
more than two months ago. When reading Semaphores on chapter 11
section 2 (11.2) I have noticed that semaphore abstraction seems too
low level than it should be. In addition, it treats Signal and Wait as
two separate abstractions as shown in the code below.

   type Signal_Interface is synchronized interface;
   procedure Signal (Sem : in out Signal_Interface) is abstract;
   type Any_Signal_Interface is access all Signal_Interface'Class;

   type Wait_Interface is synchronized interface;
   procedure Wait (Sem : in out Wait_Interface) is abstract;
   type Any_Wait_Interface is access all Wait_Interface'Class;

   type Semaphore_Interface is synchronized interface and
Signal_Interface
                                                           and
Wait_Interface;
   type Any_Semaphore_Interface is access all
Semaphore_Interface'Class;

However, I think that semaphore abstraction is low enough, while
operations Signal and Wait should operation on Semaphore Interface as
demonstrated below.

   type Semaphore_Interface is synchronized interface;
   procedure Signal (Sem : in out Semaphore_Interface) is abstract;
   procedure Wait (Sem : in out Semaphore_Interface) is abstract;
   type Any_Semaphore_Interface is access all
Semaphore_Interface'Class;

I would like to know which of these two abstractions is preferred and
why?
Thanks.
AV




             reply	other threads:[~2007-10-08 23:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 23:23 Anh Vo [this message]
2007-10-09  8:15 ` Abstraction - How detail should it be Dmitry A. Kazakov
replies disabled

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