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 Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.

On Fri, Mar 19, 2021 at 11:59 AM David Storrs <[email protected]> wrote:
>
> 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 nothing seems like 
> a great fit.  I could do polling via sleep or alarm-evt but that seems 
> inefficient.  Is there a better way?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAE8gKocbPgjcFAF_o2g6mhZBEH8PpeGyJ4CwznKc3DZkMjY%3DGw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJYbDanE4zqgFRAFSYs4kdLzjKf9xg3xi0JMNU7VmFREstNBgQ%40mail.gmail.com.

Reply via email to