#endif
// Release the suspension mutex and wait till we are resumed.
- thread->suspendcond->wait(thread->suspendmutex);
+ while (thread->suspend_reason != SUSPEND_REASON_NONE)
+ thread->suspendcond->wait(thread->suspendmutex);
#if defined(ENABLE_GC_CACAO)
// XXX This is propably not ok!
/**
* Suspend the passed thread. Execution of that thread stops until the thread
- * is explicitly resumend again.
+ * is explicitly resumed again.
*
* @param thread The thread to be suspended.
* @param reason Reason for suspending the given thread.
os::abort_errno("threads_suspend_thread: pthread_kill failed");
// Wait for the thread to acknowledge the suspension.
- // XXX A possible optimization would be to not wait here, but you
- // better think this through twice before trying it!
- thread->suspendcond->wait(thread->suspendmutex);
+ while (!thread->suspended)
+ thread->suspendcond->wait(thread->suspendmutex);
}
return true;
/* src/vm/jit/stacktrace.cpp - machine independent stacktrace system
- Copyright (C) 1996-2005, 2006, 2007, 2008
+ Copyright (C) 1996-2011
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
Copyright (C) 2009 Theobroma Systems Ltd.
/* stacktrace_print_of_thread **************************************************
- Print the current stacktrace of the given thread.
+ Print the current stacktrace of the given thread. It will only work
+ for suspended threads.
ARGUMENTS:
t ... thread
sfi = t->_stackframeinfo;
- if (sfi == NULL) {
+ if (!t->suspended || sfi == NULL) {
puts("\t<<No stacktrace available>>");
fflush(stdout);
return;