Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/GAP/hpcgap/demo/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 537 B image not shown  

Quelle  actortest2.g   Sprache: unbekannt

 
MakeThreadLocal("MyCounter");

actor := StartActor( rec(
  _Init := function() MyCounter := 0; end,
  _AtExit := function() Display(MyCounter); Unbind(MyCounter); end,
  Inc := function() MyCounter := MyCounter + 1; end,
  Dec := function() MyCounter := MyCounter - 1; end,
  Finish := function() ExitActor(); end
) );

# The following calls are asynchronous rather than synchronous
# and return immediately; they will be executed when the actor
# receives the underlying message.

actor.Inc();
actor.Inc();
actor.Dec();
actor.Finish();

[ Dauer der Verarbeitung: 0.24 Sekunden  (vorverarbeitet)  ]