Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit de63d123 authored by deuce's avatar deuce

Force od_sleep(0) to upgrade to od_sleep(1) - kills 100% CPU usage.

parent 01cac0d9
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <glob.h> #include <glob.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sched.h>
#endif #endif
#include "ODGen.h" #include "ODGen.h"
#include "ODCore.h" #include "ODCore.h"
...@@ -614,6 +615,8 @@ BOOL ODTimerElapsed(tODTimer *pTimer) ...@@ -614,6 +615,8 @@ BOOL ODTimerElapsed(tODTimer *pTimer)
#endif /* ODPLAT_WIN32 */ #endif /* ODPLAT_WIN32 */
#ifdef ODPLAT_NIX #ifdef ODPLAT_NIX
tv.tv_sec=0;
tv.tv_usec=1000;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
end.tv_sec=pTimer->Start.tv_sec+(pTimer->Duration / 1000); end.tv_sec=pTimer->Start.tv_sec+(pTimer->Duration / 1000);
end.tv_usec=(pTimer->Start.tv_usec+(pTimer->Duration*1000))%1000000; end.tv_usec=(pTimer->Start.tv_usec+(pTimer->Duration*1000))%1000000;
...@@ -804,6 +807,12 @@ ODAPIDEF void ODCALL od_sleep(tODMilliSec Milliseconds) ...@@ -804,6 +807,12 @@ ODAPIDEF void ODCALL od_sleep(tODMilliSec Milliseconds)
#endif /* ODPLAT_WIN32 */ #endif /* ODPLAT_WIN32 */
#ifdef ODPLAT_NIX #ifdef ODPLAT_NIX
sched_yield();
/* Prevent 100% CPU usage! */
if(Milliseconds==0)
Milliseconds=1;
tv.tv_sec=Milliseconds/1000; tv.tv_sec=Milliseconds/1000;
tv.tv_usec=(Milliseconds%1000)*1000; tv.tv_usec=(Milliseconds%1000)*1000;
select(0,NULL,NULL,NULL,&tv); select(0,NULL,NULL,NULL,&tv);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment