From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
autolearn_force=no version=3.4.4
X-Google-Thread: a07f3367d7,89f9122dd5615559
X-Google-Attributes: gida07f3367d7,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path:
g2news1.google.com!news4.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!195.14.215.230.MISMATCH!news.netcologne.de!newsfeed-hp2.netcologne.de!news.stw-bonn.de!news.uni-stuttgart.de!not-for-mail
From: Peter Hermann
Newsgroups: comp.lang.ada
Subject: Re: Presentations on-line - Ada&SPARK for Education&Research
Date: Fri, 5 Mar 2010 12:11:09 +0000 (UTC)
Organization: Comp.Center (RUS), U of Stuttgart, FRG
Message-ID:
References:
<4b90babf$0$7625$9b4e6d93@newsspool1.arcor-online.net>
X-Trace: infosun2.rus.uni-stuttgart.de 1267791069 1316 141.58.7.20 (5 Mar 2010
12:11:09 GMT)
X-Complaints-To: news@news.uni-stuttgart.de
NNTP-Posting-Date: Fri, 5 Mar 2010 12:11:09 +0000 (UTC)
User-Agent: tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/2.6.26-2-686 (i686))
Xref: g2news1.google.com comp.lang.ada:9426
Date: 2010-03-05T12:11:09+00:00
List-Id:
Georg Bauhaus 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;