From d5ed4e8ada6a596d424814e10190ad756f637e81 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 20 Feb 2012 19:03:56 -0800 Subject: [PATCH] NSM: Process more than one message per wait cycle! --- nonlib/NSM/Client.C | 5 +++-- nonlib/NSM/Client.H | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nonlib/NSM/Client.C b/nonlib/NSM/Client.C index 526d520..ab51b7e 100644 --- a/nonlib/NSM/Client.C +++ b/nonlib/NSM/Client.C @@ -122,9 +122,10 @@ namespace NSM } void - Client::check ( ) + Client::check ( int timeout ) { - lo_server_recv_noblock( _server, 0 ); + if ( lo_server_wait( _server, timeout ) ) + while ( lo_server_recv_noblock( _server, 0 ) ) {} } void diff --git a/nonlib/NSM/Client.H b/nonlib/NSM/Client.H index 6aa45f9..870777f 100644 --- a/nonlib/NSM/Client.H +++ b/nonlib/NSM/Client.H @@ -72,7 +72,7 @@ namespace NSM int init_thread ( void ); /* call this periodically to check for new messages */ - void check ( void ); + void check ( int timeout = 0 ); /* or call these to start and stop a thread (must do your own locking in handler!) */ void start ( void );