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:
Matthew Flatt 2013-12-28 07:34:28 -06:00
parent 94771f16ed
commit 5ea4c2ab68
2 changed files with 21 additions and 4 deletions

View File

@ -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))

View File

@ -3488,9 +3488,6 @@ static int place_channel_ready(Scheme_Object *so, Scheme_Schedule_Info *sinfo) {
return 1;
}
if (no_writers)
return 1; /* wake up to discover that we can give up */
return 0;
}