Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-30 Thread Jan Dvořák
Thanks for your time. On Thu, 2015-01-29 at 12:55 -0700, Matthew Flatt wrote: Would the simpler `once-evt` work in your situation, or do you need the guarantee that only one wait of E happens at a time? OK, my original goal is to implement a remote method call multiplexer. The kind where you

Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-29 Thread Matthew Flatt
Hi Jan, Interesting problem! I think I see what you mean: There's no way to combine the completion of an event plus saving its value as an atomic operation, except by putting the synchronization in its own thread. But if you put the synchronization in its own thread, then there's no way to

Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-29 Thread Robby Findler
Is the issue that the E_b from Jan's original message might produce multiple values and you are supposed to take the value that's available only after something syncs on the E_m? That is, I thought you could just create a separate thread that sync's on E_b and then whenever you get a value from

Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-29 Thread Jan Dvořák
On Thu, 2015-01-29 at 16:41 -0600, Robby Findler wrote: That is, I thought you could just create a separate thread that sync's on E_b and then whenever you get a value from it, then the E_m would just continue to produce that all the time. But I think you're saying that wouldn't work? The

[racket-dev] feature request: thread-safe memoize-evt

2015-01-28 Thread Jan Dvořák
Hi, I would like to ask for another extension of the Racket's event handling system. A `memoize-evt` constructor with following semantics: Given a base event E_b, memoize-evt will produce a memoizing event E_m. Synchronizing on E_m from any number of threads will block until a single value is