fix bug in thread-rewind-receive

svn: r9090
This commit is contained in:
Matthew Flatt 2008-03-26 12:41:03 +00:00
parent 5f2c2002bc
commit d2cdc315a9
2 changed files with 9 additions and 6 deletions

View File

@ -745,6 +745,9 @@
(thread-send t 'x (lambda () (values 'a 'z)))))
(err/rt-test (thread-send t 'x)))
;; make sure it's ok for rewind to be the first action:
(test (void) thread-wait (thread (lambda () (thread-rewind-receive '(1 2 3)))))
;; ----------------------------------------
;; Garbage collection

View File

@ -1053,6 +1053,8 @@ static void mbox_push_front(Scheme_Thread *p, Scheme_Object *lst)
int cnt = -1;
Scheme_Object *next, *hd;
make_mbox_sema(p);
next = lst;
while (!SCHEME_NULLP(next)) {
/* Push one: */
@ -1065,12 +1067,10 @@ static void mbox_push_front(Scheme_Thread *p, Scheme_Object *lst)
next = SCHEME_CDR(next);
if (SCHEME_NULLP(next) || (cnt == 256)) {
/* Either done or need to use fuel */
if (cnt > -1) {
/* do a single post for all messages */
((Scheme_Sema*)p->mbox_sema)->value += cnt;
scheme_post_sema(p->mbox_sema);
}
/* Either done or need to pause to allow breaks/swaps; */
/* do a single post for all messages so far. */
((Scheme_Sema*)p->mbox_sema)->value += cnt;
scheme_post_sema(p->mbox_sema);
SCHEME_USE_FUEL(cnt+1); /* might sleep */
cnt = -1;
}