- MGR: Use Sleep instead of Yield for the async thread loop. On Posix

systems all Yield translates to is sched_yield but only if
        HAVE_SCHED_YIELD is defined in the wxWidget config file.  If it isn't
        defined it becomes a null op. The async thread doesn't really need
        millisecond response times.  Have it check every 100 milliseconds
        for an RPC to process.
        
    clientgui/
        AsyncRPC.cpp

svn path=/trunk/boinc/; revision=16398
This commit is contained in:
Rom Walton 2008-11-04 00:00:59 +00:00
parent ae95ae0527
commit 63c123fdc5
2 changed files with 18 additions and 13 deletions

View File

@ -9036,3 +9036,14 @@ David 3 Nov 2008
cpu_sched.cpp cpu_sched.cpp
sched/ sched/
file_deleter.cpp file_deleter.cpp
Rom 3 Nov 2008
- MGR: Use Sleep instead of Yield for the async thread loop. On Posix
systems all Yield translates to is sched_yield but only if
HAVE_SCHED_YIELD is defined in the wxWidget config file. If it isn't
defined it becomes a null op. The async thread doesn't really need
millisecond response times. Have it check every 100 milliseconds
for an RPC to process.
clientgui/
AsyncRPC.cpp

View File

@ -118,23 +118,17 @@ void *RPCThread::Entry() {
int retval; int retval;
CRPCFinishedEvent RPC_done_event( wxEVT_RPC_FINISHED ); CRPCFinishedEvent RPC_done_event( wxEVT_RPC_FINISHED );
while(true) { // check if we were asked to exit
// check if we were asked to exit while(!TestDestroy()) {
if ( TestDestroy() )
break;
if (! m_pDoc->GetCurrentRPCRequest()->isActive) { // Wait until CMainDocument issues next RPC request
// Wait until CMainDocument issues next RPC request if (!m_pDoc->GetCurrentRPCRequest()->isActive) {
#ifdef __WXMSW__ // Until we can suspend the thread without Deadlock on Windows Sleep(100);
Sleep(1);
#else
Yield();
#endif
continue; continue;
} }
if (! m_pDoc->IsConnected()) { if (!m_pDoc->IsConnected()) {
Yield(); Sleep(100);
} }
retval = ProcessRPCRequest(); retval = ProcessRPCRequest();