cs,thread: fix thread-receive-evt retry proc

Fixes #3813
This commit is contained in:
Bogdan Popa 2021-05-03 10:16:14 +03:00 committed by Matthew Flatt
parent d9c128fe65
commit 0c8e3765f2
3 changed files with 30 additions and 4 deletions

View File

@ -1041,6 +1041,23 @@
;; make sure it's ok for rewind to be the first action:
(test (void) thread-wait (thread (lambda () (thread-rewind-receive '(1 2 3)))))
(let* ([t (thread/suspend-to-kill
(lambda ()
(let loop ()
(sync
(handle-evt
(thread-receive-evt)
(λ (_)
(channel-put (thread-receive) 'ok)
(loop)))))))]
[res (for/list ([_ (in-range 2)])
(thread-suspend t)
(thread-resume t (current-thread))
(define ch (make-channel))
(thread-send t ch)
(channel-get ch))])
(test '(ok ok) values res))
;; ----------------------------------------
;; Unsafe poller

View File

@ -8085,7 +8085,7 @@
(begin-unsafe (queue-add-front! (thread-mailbox t_0) msg_0)))
lst_0))
(end-atomic)))))))
(define finish_2470
(define finish_2013
(make-struct-type-install-properties
'(thread-receive-evt)
0
@ -8131,7 +8131,12 @@
(lambda (v_0) self_0)
(lambda () (set-thread-mailbox-wakeup! t_0 void))
(lambda () (set! receive_0 void))
(lambda () (add-wakeup-callback!_0)))))))))))))))
(lambda ()
(begin
(add-wakeup-callback!_0)
(if (is-mail? t_0)
(values self_0 #t)
(values #f #f)))))))))))))))))
(current-inspector)
#f
'()
@ -8146,7 +8151,7 @@
#f
0
0))
(define effect_2506 (finish_2470 struct:thread-receiver-evt))
(define effect_2506 (finish_2013 struct:thread-receiver-evt))
(define thread-receiver-evt26.1
(|#%name|
thread-receiver-evt

View File

@ -1033,7 +1033,11 @@
;; abandon:
(lambda () (set! receive void))
;; retry (was interrupted, but not abandoned):
(lambda () (add-wakeup-callback!))))])))
(lambda ()
(add-wakeup-callback!)
(if (is-mail? t)
(values self #t)
(values #f #f)))))])))
#:reflection-name 'thread-receive-evt)
(define/who (thread-receive-evt)