Kévin Seroux:
As reported here (http://forum.flightgear.org/viewtopic.php?f=32&t=26629),
the FGCom standalone client use 100% of the CPU when it is in OBS mode. The fact to add the shortest sleep time
(1ms) has solved the problem. With this patch, I run FGCom with 1% of CPU usage instead of 100%.
while(_running) {
int bytes = sgSocket.recv(currentPacket, sizeof(currentPacket)-1, 0);
- if (bytes == -1)
+ if (bytes == -1) {
+ SGTimeStamp::sleepForMSec(1); // Prevent full CPU usage (loop)
continue;
+ }
currentPacket[bytes] = '\0';
if( strcmp(currentPacket, previousPacket) != 0 ) {