Skip to content
Snippets Groups Projects
Commit f510adf8 authored by rswindell's avatar rswindell
Browse files

SLEEP/mswait is now defined as a call to select() in Unix builds.

This fixes the 100% CPU utilization bug in *BSD builds with multiple
simultaneous TCP clients.
parent d2108694
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,14 @@ extern "C" {
#elif defined(__unix__)
/* usleep() apparently doesn't work right (100% CPU utilization) */
#if 0 /* with multiple clients/threads on *BSD */
#define SLEEP(x) usleep(x*1000)
#else
#define SLEEP(x) ({ int y=x; struct timeval tv; \
tv.tv_sec=(y/1000); tv.tv_usec=((y%1000)*1000); \
select(0,NULL,NULL,NULL,&tv); })
#endif
#define BEEP(freq,dur) unix_beep(freq,dur)
DLLEXPORT void DLLCALL unix_beep(int freq, int dur);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment