comp.lang.ada
 help / color / mirror / Atom feed
* Imported Monolitic Monitor
@ 1999-03-05  0:00 Juan Carlos Díaz Martín
  1999-03-05  0:00 ` dennison
  0 siblings, 1 reply; 4+ messages in thread
From: Juan Carlos Díaz Martín @ 1999-03-05  0:00 UTC (permalink / raw)


Let's be the C procedures in a module that share global data

 a
 b
 c

and I make a C library with them. This library will be used by a
multitasked Ada95 application by the pragma Import

Tasks T, Q and R may invoke a, b or c in a concurrent, uncontrolled way.
Isn't it? I'm interested in a, b and c to be executed in mutual
exclusion to preserve global data integrity. The question is: How do I
do it in Ada95?
I've thought in a protected object, such as:

protected Monitor is
  procedure a;
  procedure b;
  procedure c;
end Monitor;

The object could be used:

with Monitor;
procedure P is
begin
  ...
  a; b; c;
  ...
end P;

task T is      task Q is     task R is
begin          begin         begin
  P;             P;            P;
end;           end;          end;

Does this way guarantee mutual exclusion of a, b and c??? Any ideas??

Thanks in advance
Juan Carlos




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-03-08  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-05  0:00 Imported Monolitic Monitor Juan Carlos Díaz Martín
1999-03-05  0:00 ` dennison
1999-03-07  0:00   ` Nick Roberts
1999-03-08  0:00     ` robert_dewar

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