View Single Post
  #1  
Old 11-13-2009, 07:29 AM
erde
Sarnak
 
Join Date: Sep 2006
Location: Germany
Posts: 82
Default unix "Sleep" implementation bug

After looking in eqlaunch.cpp i found somethin wired. eqlaunch contains this

Code:
if(zones.empty())
			Sleep(5000);
		else
			Sleep(2000);
to wait 5 or 2 seconds but in common/unix.cpp "Sleep" is implemented as

Code:
void Sleep(unsigned int x) {
	if (x > 0)
		usleep(x*1000);
}
so eqlaunch will wait 5*1000 seconds ! this seems to produce an overflow and my NetBSD 64bit QuadCore uses 100% CPU time.

after changing it to

Code:
void Sleep(unsigned int x) {
	if (x > 0)
		usleep(x);
}
everything is ok
__________________
"Yes, the artwork is awful. I am an engineer, not an artist " - David H. Eberly
Reply With Quote