comp.lang.ada
 help / color / mirror / Atom feed
* C omega
@ 2004-06-05 14:25 Pascal Obry
  2004-06-05 17:49 ` Wes Groleau
  2004-06-05 22:06 ` Adrian Knoth
  0 siblings, 2 replies; 13+ messages in thread
From: Pascal Obry @ 2004-06-05 14:25 UTC (permalink / raw)



Something quite interesting. Microsoft is going to add some concurrency
support in C-omega. There is a paper on the link I gave in a previous message.
They present the classic Reader-Writer paradigm using the C-omega chord
(only 5 chords they say) implementation, here it is:

class ReaderWriter
{
  ReaderWriter() { idle (); }

  public void Shared() & async idle() {s (1); }
  public void Shared() & async s(int n) { s(n+1); }
  public void ReleaseShared() & async s(int n) {
    if (n == 1) idle (); else s(n-1);
  }
  public void Exclusive() & async idle() {}
  public void ReleaseExclusive() {idle (); }
}

I'm not sure to fully understand the code above, but it looks quite complex
to me :)

What is interesting is that the same code(*) in Ada (not compiled) is:

protected Reader_Writer is
   function Read return Integer;
   procedure Write (X : in Integer);
private
   State : Integer;
end Reader_Writer;

protected body Reader_Writer is

   function Read return Integer is
   begin
      return State;
   end Read;

   procedure Write (X : in Integer) is
   begin
      State := X;
   end Write;

end Reader_Writer;

But of course they have given some modula-3 code to compare to the C-omega
one! Isn't it fair ?!?

Pascal.

(*) I suppose it is the same code by reading the description they gave about
the ReaderWriter C-omega implementation.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

end of thread, other threads:[~2004-06-07 15:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-05 14:25 C omega Pascal Obry
2004-06-05 17:49 ` Wes Groleau
2004-06-05 22:06 ` Adrian Knoth
2004-06-05 23:55   ` Roland Illig
2004-06-06  2:21     ` James Rogers
2004-06-06  2:53       ` Wes Groleau
2004-06-06 18:09         ` [off-topic] bad puns Wes Groleau
2004-06-06  9:47       ` C omega Pascal Obry
2004-06-06 12:32         ` James Rogers
2004-06-06  9:49   ` Pascal Obry
2004-06-06 22:14   ` Georg Bauhaus
2004-06-07 11:17     ` I R T
2004-06-07 15:45     ` Adrian Knoth

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