From 3e3ed33cbf7881dce0e00ed1abf43add12af06fb Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 28 Dec 2010 11:09:38 -0700 Subject: [PATCH] detect and report a case of deadlock --- src/racket/src/sema.c | 12 ++++-------- src/racket/src/thread.c | 5 +++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/racket/src/sema.c b/src/racket/src/sema.c index cbf7c92f27..02c6ffe390 100644 --- a/src/racket/src/sema.c +++ b/src/racket/src/sema.c @@ -657,15 +657,11 @@ int scheme_wait_semas_chs(int n, Scheme_Object **o, int just_try, Syncing *synci } if (ii >= n) { - if (!scheme_current_thread->next) + if (!scheme_wait_until_suspend_ok()) { break; - else { - if (!scheme_wait_until_suspend_ok()) { - break; - } else { - /* there may have been some action on one of the waitables; - try again */ - } + } else { + /* there may have been some action on one of the waitables; + try again */ } } else break; diff --git a/src/racket/src/thread.c b/src/racket/src/thread.c index 14e20b8768..0de2f7fe17 100644 --- a/src/racket/src/thread.c +++ b/src/racket/src/thread.c @@ -4641,6 +4641,11 @@ int scheme_wait_until_suspend_ok(void) --atomic_timeout_auto_suspend; } + if (do_atomic) { + scheme_log_abort("about to suspend in atomic mode"); + abort(); + } + return did; }