Re: [racket-dev] scheme_sema_post_all
On 2011-10-22 9:41 AM, Tony Garnock-Jones wrote: > (Context: I want to build a kind of box that starts empty, is able to be > given a value exactly once, and that threads can wait on until its value > is set by some other thread. Currently I'm using a channel and a > newly-spun-up thread that loops in a channel-put, but it's not kill-safe > I don't think, and creating a thread whenever the box is filled is quite > heavy compared to doing a scheme_sema_post_all. Incidentally, the > behaviour I'm after is very similar to (thread-dead-evt). I'll be using > it, among other things, to hold the fatal exception that killed a > thread, if any.) Nothing like the 20 seconds or so after a post to make one question oneself. Could it be that semaphore-peek-evt could be used to get what I need? I'll experiment. Regards, Tony _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] scheme_sema_post_all
Hi all, It looks like scheme_sema_post_all has the effect of an infinite number of scheme_sema_post calls. Is that right? If so, that's exactly what I need: would it make sense to expose the functionality, perhaps as (semaphore-post-infinite) or (semaphore-post-all)? (Context: I want to build a kind of box that starts empty, is able to be given a value exactly once, and that threads can wait on until its value is set by some other thread. Currently I'm using a channel and a newly-spun-up thread that loops in a channel-put, but it's not kill-safe I don't think, and creating a thread whenever the box is filled is quite heavy compared to doing a scheme_sema_post_all. Incidentally, the behaviour I'm after is very similar to (thread-dead-evt). I'll be using it, among other things, to hold the fatal exception that killed a thread, if any.) Regards, Tony _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev