blocking_03.gm 424 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Basic blocking and signalling #3
  3. */
  4. global thread_1 = function()
  5. {
  6. block("WAKEUP");
  7. print("I just woke up, boy was I tired! You should wake up too!");
  8. signal("YOUTOO");
  9. };
  10. global thread_2 = function()
  11. {
  12. block("YOUTOO");
  13. print("What did you wake me up for?");
  14. };
  15. // Launch thread
  16. thread( thread_2 );
  17. thread( thread_1 );
  18. // Sleep for 1 secs then set the wakeup variable
  19. sleep(1);
  20. signal("WAKEUP");