[racket-dev] scheme_sema_post_all

2011-10-22 Thread Tony Garnock-Jones
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

Re: [racket-dev] scheme_sema_post_all

2011-10-22 Thread Tony Garnock-Jones
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

[racket-dev] Kill-safe, single-write, blocking box (was Re: scheme_sema_post_all)

2011-10-22 Thread Tony Garnock-Jones
On 2011-10-22 9:43 AM, Tony Garnock-Jones wrote: 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. The answer is almost, i.e. no. But scheme_sema_post_all doesn't do what I want

[racket-dev] Thread exit status

2011-10-22 Thread Tony Garnock-Jones
Hi all, What do people think of the idea of threads preserving their exit status? The exit status would be either - a raised exception, or - a normally-returned value, or - nothing as yet, because the thread is still running. (thread-died-with-exception? thd) - boolean? Returns #t if

Re: [racket-dev] Thread exit status

2011-10-22 Thread Jay McCarthy
I don't think any change is necessary, because this can be done as a library: https://github.com/jeapostrophe/exp/blob/master/ethread.rkt On Sat, Oct 22, 2011 at 8:54 AM, Tony Garnock-Jones to...@ccs.neu.edu wrote: Hi all, What do people think of the idea of threads preserving their exit

Re: [racket-dev] Thread exit status

2011-10-22 Thread Tony Garnock-Jones
On 2011-10-22 11:14 AM, Jay McCarthy wrote: I don't think any change is necessary, because this can be done as a library: https://github.com/jeapostrophe/exp/blob/master/ethread.rkt I was hoping for something that works for threads created using (thread) as well. Using either your approach or

Re: [racket-dev] Kill-safe, single-write, blocking box (was Re: scheme_sema_post_all)

2011-10-22 Thread Matthew Flatt
I think you could get this behavior by creating a manager thread when you create the new kind of box. If threads are too heavyweight, though, you can get the effect of a primitive by using `ffi/unsafe/atomic'. At Sat, 22 Oct 2011 10:24:27 -0400, Tony Garnock-Jones wrote: On 2011-10-22 9:43 AM,

Re: [racket-dev] Kill-safe, single-write, blocking box (was Re: scheme_sema_post_all)

2011-10-22 Thread Tony Garnock-Jones
On 2011-10-22 11:42 AM, Matthew Flatt wrote: I think you could get this behavior by creating a manager thread when you create the new kind of box. If threads are too heavyweight, though, you can get the effect of a primitive by using `ffi/unsafe/atomic'. Of course! Using a thread to manage the

Re: [racket-dev] Thread exit status

2011-10-22 Thread Jay McCarthy
On Sat, Oct 22, 2011 at 9:33 AM, Tony Garnock-Jones to...@ccs.neu.edu wrote: On 2011-10-22 11:14 AM, Jay McCarthy wrote: I don't think any change is necessary, because this can be done as a library: https://github.com/jeapostrophe/exp/blob/master/ethread.rkt I was hoping for something that

Re: [racket-dev] Thread exit status

2011-10-22 Thread Tony Garnock-Jones
On 2011-10-22 12:02 PM, Jay McCarthy wrote: Eh, I think imposing this on all the threads would be a bad idea because it would increase memory usage unexpectedly for a lot of programs, I would guess Only those holding references to their threads well beyond the lifetime of said threads. Is

Re: [racket-dev] Thread exit status

2011-10-22 Thread Eli Barzilay
Sound like `delay/thread' might be doing everything you need. On Oct 22, 2011, at 9:54 AM, Tony Garnock-Jones to...@ccs.neu.edu wrote: Hi all, What do people think of the idea of threads preserving their exit status? The exit status would be either - a raised exception, or - a

Re: [racket-dev] Thread exit status

2011-10-22 Thread Eli Barzilay
An hour and a half ago, Tony Garnock-Jones wrote: On 2011-10-22 1:27 PM, Eli Barzilay wrote: Sound like `delay/thread' might be doing everything you need. That's a neat thing, but it's not quite what I'm after. I have a collection of threads that are started independently and later start

Re: [racket-dev] Thread exit status

2011-10-22 Thread Tony Garnock-Jones
On 2011-10-22 5:10 PM, Eli Barzilay wrote: I don't see how why that cannot be built on top of `delay/thread'. Because 1. the threads may not have been started via delay/thread, and 2. there is no way to get from (current-thread) to the promise. My best bet so far seems to be something along the

[racket-dev] [PATCH 1/3] add missing word

2011-10-22 Thread Eric Hanchrow
--- collects/scribblings/guide/unit.scrbl |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/collects/scribblings/guide/unit.scrbl b/collects/scribblings/guide/unit.scrbl index d464aa6..7f7ce01 100644 --- a/collects/scribblings/guide/unit.scrbl +++

[racket-dev] [PATCH 2/3] add an s

2011-10-22 Thread Eric Hanchrow
--- collects/web-server/scribblings/web-server.scrbl |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/collects/web-server/scribblings/web-server.scrbl b/collects/web-server/scribblings/web-server.scrbl index 3bd1910..11c610c 100644 ---

[racket-dev] [PATCH 3/3] Add missing word

2011-10-22 Thread Eric Hanchrow
--- collects/scribblings/foreign/intro.scrbl |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/collects/scribblings/foreign/intro.scrbl b/collects/scribblings/foreign/intro.scrbl index ba7912a..963c656 100644 --- a/collects/scribblings/foreign/intro.scrbl +++

Re: [racket-dev] [PATCH 1/3] add missing word

2011-10-22 Thread Vincent St-Amour
I just pushed all 3. Thanks for the patches! Vincent At Sat, 22 Oct 2011 14:47:41 -0700, Eric Hanchrow wrote: --- collects/scribblings/guide/unit.scrbl |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/collects/scribblings/guide/unit.scrbl

Re: [racket-dev] Thread exit status

2011-10-22 Thread Eli Barzilay
Four hours ago, Tony Garnock-Jones wrote: On 2011-10-22 5:10 PM, Eli Barzilay wrote: I don't see how why that cannot be built on top of `delay/thread'. Because 1. the threads may not have been started via delay/thread, and 2. there is no way to get from (current-thread) to the promise.