From 3988b2661f29af4df3ef461269075c6d2fe79859 Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 26 May 2009 21:48:02 +0000 Subject: [PATCH] fix device thread sleep - keep one eye open! --- source/ngc/fileop.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index d800351..dea0c71 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -85,10 +85,19 @@ HaltDeviceThread() * This checks our devices for changes (SD/USB removed) and * initializes the network in the background ***************************************************************************/ +static int devsleep = 3*1000*1000; + static void * devicecallback (void *arg) { - sleep(1); + while(devsleep > 0) + { + if(deviceHalt) + LWP_SuspendThread(devicethread); + usleep(100); + devsleep -= 100; + } + while (1) { #ifdef HW_RVL @@ -130,10 +139,15 @@ devicecallback (void *arg) } } #endif - if(deviceHalt) - LWP_SuspendThread(devicethread); - else - sleep(1); // suspend thread for 1 sec + devsleep = 1000*1000; // 1 sec + + while(devsleep > 0) + { + if(deviceHalt) + LWP_SuspendThread(devicethread); + usleep(100); + devsleep -= 100; + } } return NULL; }