comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Hermann <p@s.de>
Subject: Re: Presentations on-line - Ada&SPARK for Education&Research
Date: Fri, 5 Mar 2010 12:11:09 +0000 (UTC)
Date: 2010-03-05T12:11:09+00:00	[thread overview]
Message-ID: <hmqsct$194$1@infosun2.rus.uni-stuttgart.de> (raw)
In-Reply-To: 4b90babf$0$7625$9b4e6d93@newsspool1.arcor-online.net

Georg Bauhaus <rm-host.bauhaus@maps.futureapps.de> wrote:
> I'm reading a few presentation pages that advertise  the strengths
> of Ada. One sheet compares monitor functionalities as present
> in Java and Ada.  Java needs much care not to break
> a monitor.  Ada is shown not to have this problem.
> 
> True?  With some effort, it seems possible to break an Ada
> monitor implemented as a protected object.
> 
> package Monitor is
> 
>     type SynchNode;
>     type Linkage is access all synchnode;
>     type data is access all integer;
> 
>     protected type synchnode is
>        procedure Link (x : Linkage);
>        procedure Expose (N : out Data);
>     private
>        Outgoing : aliased Integer := 0;
>     end SynchNode;
> 
> end Monitor;
> 
> package body monitor is
> 
>     protected body synchnode is
>        procedure link (X : Linkage) is
>           View : Data; -- X's data
>        begin
>           X.Expose(View);
>           View.all := View.all + 1;  -- <-- unprotected
>        end link;
> 
>        procedure Expose (N : out Data) is
>        begin
>           N := Outgoing'unchecked_access;

monitor.adb:69:24: warning: possible unprotected access to protected data

>        end expose;
>     end SynchNode;
> 
> end Monitor;





  parent reply	other threads:[~2010-03-05 12:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 21:22 Presentations on-line - Ada&SPARK for Education&Research Dirk Craeynest
2010-03-05  8:03 ` Georg Bauhaus
2010-03-05  9:14   ` J-P. Rosen
2010-03-05 10:46     ` Georg Bauhaus
2010-03-06  8:43     ` Jerry van Dijk
2010-03-08  5:54       ` AdaMagica
2010-03-05  9:19   ` Dmitry A. Kazakov
2010-03-05 12:11   ` Peter Hermann [this message]
2010-03-06 12:40 ` Marco
replies disabled

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