Changeset 2929

Show
Ignore:
Timestamp:
11/12/99 10:56:56 (14 years ago)
Author:
ucacoxh
Message:

- Use WaitForSingleObject? on event that never gets signalled rather than

select in code to save cpu cycles. select may cause process to pause but
it's reported CPU usage is 100% and this freaks people out. Now its ~1-3%

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • rat/trunk/main_ui.c

    r2924 r2929  
    6161 
    6262#ifdef WIN32 
     63        HANDLE     hWakeUpEvent; 
    6364        TkWinXInit(hAppInstance); 
     65        hWakeUpEvent = CreateEvent(NULL, FALSE, FALSE, "Local\\RAT UI WakeUp Event"); 
    6466#endif 
    6567 
     
    122124                timeout.tv_sec  = 0; 
    123125                timeout.tv_usec = 40000; 
     126        /* Throttle CPU usage */ 
     127#ifdef WIN32 
     128                /* Just timeout waiting for event that never happens */ 
     129                WaitForSingleObject(hWakeUpEvent, 40); 
     130#else 
    124131                select(0, NULL, NULL, NULL, &timeout); 
     132#endif 
    125133        } 
    126134