Skip to content

Commit

Permalink
Reduce CPU usage of serial event generator.
Browse files Browse the repository at this point in the history
There's no reason for the select(2) call to have a 1ms timeout. At that
point, it's basically a busy loop. A 100ms timeout greatly reduces CPU
usage while retaining fairly quick responsiveness to port closure.

Closes #36.
  • Loading branch information
MrDOS committed Nov 20, 2015
1 parent 728e711 commit ea5c096
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/c/src/SerialImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4146,7 +4146,7 @@ int initialise_event_info_struct( struct event_info_struct *eis )
if (eis->fd < FD_SETSIZE && eis->fd > 0) {
FD_SET( eis->fd, &eis->rfds );
eis->tv_sleep.tv_sec = 0;
eis->tv_sleep.tv_usec = 1000;
eis->tv_sleep.tv_usec = 100 * 1000;
eis->initialised = 1;
return( 1 );
} else {
Expand Down

0 comments on commit ea5c096

Please sign in to comment.