- A question on hythread_resume()
- Line 318: " if (thread->safepoint_callback &&
thread->suspend_request < 2) return"
- is there ever the situation where "thread->suspend_request == 0 "
??
-
- is there a race condition in the use of
"thread->suspend_request" in lines 318, 319, 320?
- In specific, does it make sense to replace these lines
of code with something like:
int current_suspend_request_count;
while (1) {
current_suspend_request_count = thread->suspend_request;
if (thread->safepoint_callback && current_suspend_request_count < 2) return;
int status = apr_atomic_casptr (current_suspend_request_count,
current_suspend_request--, ((apr_uint32_t *)&(thread->suspend_request);
if(/*original thread->suspend_request*/ status == 1) { /* thus the
new value has to be zero
// Notify the thread that it may wake up now
hysem_post(thread->resume_event);
TRACE(("TM: resume one thread: %p request count: %d",thread ,
thread->suspend_request));
thread->state &= ~TM_THREAD_STATE_SUSPENDED;
break;
--
Weldon Washburn
Intel Enterprise Solutions Software Division