comp.lang.ada
 help / color / mirror / Atom feed
From: "Juan Carlos Díaz Martín" <juancarl@unex.es>
Subject: Imported Monolitic Monitor
Date: 1999/03/05
Date: 1999-03-05T17:33:02+00:00	[thread overview]
Message-ID: <36E014CD.55717933@unex.es> (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




             reply	other threads:[~1999-03-05  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-05  0:00 Juan Carlos Díaz Martín [this message]
1999-03-05  0:00 ` Imported Monolitic Monitor dennison
1999-03-07  0:00   ` Nick Roberts
1999-03-08  0:00     ` robert_dewar
replies disabled

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