Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread David Storrs
Ah. Thanks. On Fri, Mar 19, 2021 at 1:33 PM Jay McCarthy wrote: > It is not a built-in thing. I am talking about the use-pattern of a > condition variable: > https://en.wikipedia.org/wiki/Monitor_(synchronization)#Condition_variables > > -- > Jay McCarthy > Associate Professor @ CS @ UMass

Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread Jay McCarthy
It is not a built-in thing. I am talking about the use-pattern of a condition variable: https://en.wikipedia.org/wiki/Monitor_(synchronization)#Condition_variables -- Jay McCarthy Associate Professor @ CS @ UMass Lowell http://jeapostrophe.github.io Vincit qui se vincit. On Fri, Mar 19, 2021 at

Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread David Storrs
On Fri, Mar 19, 2021 at 12:02 PM Jay McCarthy wrote: > The best thing is to use a semaphore instead of a mutable reference. > If you can't do that, then I think that you should combine the mutable > reference with a signaling semaphore. If you can't do that, then I > can't think of anything but

Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread David Storrs
Cool. Thank you both. On Fri, Mar 19, 2021 at 12:15 PM Sam Tobin-Hochstadt wrote: > Another possibility is to send a message on a channel when the user is > set, and then just wait with `sync` for a message to appear on the > channel. > > Sam > > On Fri, Mar 19, 2021 at 12:02 PM Jay McCarthy

Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread Sam Tobin-Hochstadt
Another possibility is to send a message on a channel when the user is set, and then just wait with `sync` for a message to appear on the channel. Sam On Fri, Mar 19, 2021 at 12:02 PM Jay McCarthy wrote: > > The best thing is to use a semaphore instead of a mutable reference. > If you can't do

Re: [racket-users] Best way to say 'block until true'?

2021-03-19 Thread Jay McCarthy
The best thing is to use a semaphore instead of a mutable reference. If you can't do that, then I think that you should combine the mutable reference with a signaling semaphore. If you can't do that, then I can't think of anything but a poll. -- Jay McCarthy Associate Professor @ CS @ UMass

[racket-users] Best way to say 'block until true'?

2021-03-19 Thread David Storrs
Suppose I have a function that tests for some condition, e.g. (define current-user (make-parameter #f)) (define (current-user-set?) (not (false? (current-user))) What is the best way to say "wait until 'current-user-set?' returns true"? I've been through the Events chapter in the Reference and