Threading and waiting for completion

Is there a better idiom for waiting for threads to complete without sys_sleep guessing at the end of a main run? There is no message passing in the small examples, so I don’t think a blocking readMessage could be used. Looking for a join or somesuch, or word that things have changed and improved since I last looked a few years ago.


Idk if it’s better, but you can create a lock and wait for it:

var lock = new sys.thread.Lock();
sys.thread.Thread.create(() -> {
  //useful work