ibmruntimes / v8ppc

Port of Google V8 javascript engine to PowerPC®
Other
94 stars 19 forks source link

Thread::YieldCPU on power linux not working as expected #90

Closed mtbrandy closed 11 years ago

mtbrandy commented 11 years ago

The current implementation using sched_yield() does not reliably give other threads a chance to run. The problem is demonstrated by the poor performance of the following test case:

out/ppc.release/cctest test-api/RegExpStringModification

This test creates a second thread which needs to acquire a pthread mutex owned by the main thread. The main thread continually releases/reacquires the mutex around a call to Thread::YieldCPU (see RuntimePreempt), but the second thread still experiences long wait times.

mtbrandy commented 11 years ago

Commit c7e6d05 introduces a workaround for this issue. It replaces the call to sched_yield with Sleep(0).