The retry and retry_with (the latter is known as orElse in Haskell) support has just landed; here is an example scripts that shows how to call them.
Much thanks to Liz for coming up with the name and usage example as part of the Concurrency Spec draft. Oh, and once Charles's SoC project works, we'd be able to port that to Parrot, too. Yay! :-)
While I was working on the Ruby port of the example script, I realized: shouldn't the two threads be joined to ensure that the "Thread N finished" messages get printed before the parent thread exits? Or do I misunderstand the Perl 6 threading model?
Posted by: MenTaLguY | 2006.06.24 at 02:14 AM
MenTaLguY: That is indeed a bug. I've updated the example to add the explicit joins as you did in the Ruby port. Thanks!
Posted by: Audrey T | 2006.06.24 at 10:33 AM
You're welcome. I was playing with my Ruby version again today, and noticed that sometimes it will print -1000 before both threads exit: there's a race in the gap between the sync { a++; } and the say $a;
Posted by: MenTaLguY | 2006.07.02 at 05:19 AM
Hmm, in retrospect the gap between sync { a++; } and say $a isn't necessarily a bug. It just produces behavior that differs from my naive expectations sometimes.
Posted by: MenTaLguY | 2006.07.02 at 12:57 PM