Re: [racket-users] Best way to say "terminate unless received by X time"

2020-03-24 Thread David Storrs
Aha! I didn't know there was a udp-receive-evt. That's exactly what I needed, thank you. On Tue, Mar 24, 2020, 4:15 PM Jon Zeppieri wrote: > On Tue, Mar 24, 2020 at 4:03 PM David Storrs > wrote: > > > > I've got this code: > > > > (thread > > (thunk > > (let loop () > > (define-valu

Re: [racket-users] Best way to say "terminate unless received by X time"

2020-03-24 Thread Jon Zeppieri
On Tue, Mar 24, 2020 at 4:03 PM David Storrs wrote: > > I've got this code: > > (thread > (thunk > (let loop () > (define-values (len shost sport) (udp-receive! socket buffer)) > ...do stuff with the received message... > (loop > > I'd like to be able to say "If you have

Re: [racket-users] Best way to say "terminate unless received by X time"

2020-03-24 Thread Jay McCarthy
You can start a second thread that monitors the condition as well as a timer; if the timer goes off first, then you kill the first thread; if the condition happens first, then it continues. If you don't want the second thread to have to monitor the condition, then the first thread should tell the s

[racket-users] Best way to say "terminate unless received by X time"

2020-03-24 Thread David Storrs
I've got this code: (thread (thunk (let loop () (define-values (len shost sport) (udp-receive! socket buffer)) ...do stuff with the received message... (loop I'd like to be able to say "If you haven't received a message in X time, kill the thread". I'm not sure how to