comp.lang.ada
 help / color / mirror / Atom feed
From: stefanmairhofer@gmx.at
Subject: Observer Pattern / Concurrency with ObjectAda
Date: Mon, 19 Nov 2007 03:07:34 -0800 (PST)
Date: 2007-11-19T03:07:34-08:00	[thread overview]
Message-ID: <07095dbf-53a4-4cdb-a3bc-3302b499b98d@e1g2000hsh.googlegroups.com> (raw)

Hello!

I'm currently working on a software-pattern based project with
ObjectAda and I would require to implement an Observer pattern for my
program.

I've stumbled upon an example of the "Observer Pattern with an
Concurrent Subject" from Matthew Heaney
http://www.adapower.com/index.php?Command=Class&ClassID=Patterns&CID=287

And I was not able to run it on ObjectAda 7.2.2. Embedded (I get
access-errors, constraint-errors and sometimes deadlocks). When I
tried the program using MinGW with gccada it worked perfectly.

Apparently the Attach and Detach functions do not work properly and in
the main procedure Test_Observers the Clock declaration results in an
Constraint_Error / access error

procedure Test_Observers is

   Timer : aliased Clock_Timer;
   Clock : Digital_Clock (Timer'Access);  -- <-- Constraint_Error

begin
...

(little help : Timer = subject, which includes a task that informs the
observers via notify(),
 Clock = observer, which has the update() method)

Any ideas why it works with GNAT, but not with ObjectAda?

Thank you for your help!
Best regards
Mairhofer Stefan



                 reply	other threads:[~2007-11-19 11:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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