comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Re: Protected types made of ADT's, and Passive Iterators
Date: 1998/09/07
Date: 1998-09-07T00:00:00+00:00	[thread overview]
Message-ID: <35F3F885.93B3D3AB@elca-matrix.ch> (raw)
In-Reply-To: m3btou4urs.fsf@mheaney.ni.net

Matthew Heaney wrote:

> What's wrong with this:

You need an exception handler to release the resource on a failure. Note that
almost anything can be raised in Process.

> generic
>    with procedure Process
>       (Item : in out Collection_Item;
>        Quit : in out Boolean);
> procedure Modify_Items (Collection : in out Collection_Type);
> 
> procedure Modify_Items (Collection : in out Collection_Type) is
> 
>    Quit : Boolean := False;
>    List : List_Type;
> begin
> 
>    [as before]
> 
>    Release (Collection.Guard);

  exception
     when others =>
        Release (Collection.Guard);
        raise;
> 
> end Modify_Items;




  parent reply	other threads:[~1998-09-07  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-04  0:00 Protected types made of ADT's, and Passive Iterators John Woodruff
1998-09-05  0:00 ` Tom Moran
1998-09-05  0:00 ` Matthew Heaney
1998-09-05  0:00   ` Tom Moran
1998-09-07  0:00   ` Mats Weber [this message]
1998-09-17  0:00     ` Matthew Heaney
1998-09-07  0:00 ` Mats Weber
replies disabled

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