From: <cha...@us...> - 2007-12-20 18:14:22
|
Revision: 391 http://sipp.svn.sourceforge.net/sipp/?rev=391&view=rev Author: charlespwright Date: 2007-12-20 10:13:30 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Fix: Do not use 100% CPU when run in the background, but not with -bg. Modified Paths: -------------- sipp/branches/3_0/screen.cpp sipp/branches/3_0/sipp.cpp Modified: sipp/branches/3_0/screen.cpp =================================================================== --- sipp/branches/3_0/screen.cpp 2007-12-19 09:46:14 UTC (rev 390) +++ sipp/branches/3_0/screen.cpp 2007-12-20 18:13:30 UTC (rev 391) @@ -58,9 +58,15 @@ gettimeofday (clock, &tzp); \ } -int screen_readkey() +/* ERR is actually -1, but this prevents us from needing to use curses.h in + * sipp.cpp. */ +int screen_readkey() { - return getch(); + int c = getch(); + if (c == ERR) { + return -1; + } + return c; } void screen_exit(int rc) Modified: sipp/branches/3_0/sipp.cpp =================================================================== --- sipp/branches/3_0/sipp.cpp 2007-12-19 09:46:14 UTC (rev 390) +++ sipp/branches/3_0/sipp.cpp 2007-12-20 18:13:30 UTC (rev 391) @@ -1420,6 +1420,9 @@ while(!feof(stdin)){ c = screen_readkey(); + if (c == -1) { + return; + } if (process_key(c)) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |