fix sync
on place with no writers
A `sync` on a place whose initial channel is known to have no writers could trigger a place result instead of blocking on the place.
This commit is contained in:
parent
94771f16ed
commit
5ea4c2ab68
|
@ -0,0 +1,20 @@
|
||||||
|
#lang racket/base
|
||||||
|
(require racket/place)
|
||||||
|
|
||||||
|
;; Check that syncing on a place (as opposed to place channel)
|
||||||
|
;; known to have no writers will fail to sync (as opposed to
|
||||||
|
;; returning the place itself, for example, which was the bug
|
||||||
|
;; that triggered this test).
|
||||||
|
|
||||||
|
(define (main)
|
||||||
|
(for ([i 10])
|
||||||
|
(displayln i)
|
||||||
|
(define p (place pch (void)))
|
||||||
|
(place-wait p)
|
||||||
|
(collect-garbage)
|
||||||
|
(define v (sync/timeout 0 p))
|
||||||
|
(when v
|
||||||
|
(error "failed: " v))))
|
||||||
|
|
||||||
|
(module+ main (main))
|
||||||
|
(module+ test (main))
|
|
@ -3487,10 +3487,7 @@ static int place_channel_ready(Scheme_Object *so, Scheme_Schedule_Info *sinfo) {
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_writers)
|
|
||||||
return 1; /* wake up to discover that we can give up */
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user