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 481 B image not shown  

Quelle  actortest.g   Sprache: unbekannt

 
# Simple actor test

handlers := rec(
  _Init := function()
    Display(CurrentThread());
    Display("Hello, world!");
  end,

  _AtExit := function()
    Display(CurrentThread());
    Display("Goodbye, world!");
  end,

  print := function(x)
    Display(x);
  end,

  finish := function()
    ExitActor();
  end
);
actor := StartActor(handlers);
actor.print("a");
actor.print("b");
actor.print("c");
actor.print([1,2,3]);
actor.finish();
actor.print("should not be displayed");

[ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet)  ]