August 2008

Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Recently on this blog
Recently on other blogs

Map

Audrey

My Photo

License

« Microsoft ECS talk. | Main | use v6-pugs; »

2006.06.21

STM: retry and retry_with works!

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! :-)

Comments

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?

MenTaLguY: That is indeed a bug. I've updated the example to add the explicit joins as you did in the Ruby port. Thanks!

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;

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.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment