Bug 26 - Notification messages are delayed until network activity
Summary: Notification messages are delayed until network activity
Alias: None
Product: LinuxSampler
Classification: Unclassified
Component: LSCP (show other bugs)
Version: SVN Trunk
Hardware: PC Linux
: P2 normal
Assignee: Christian Schoenebeck
Depends on:
Reported: 2005-09-30 07:56 CEST by Grigor Iliev
Modified: 2006-10-22 22:05 CEST (History)
0 users

See Also:

patch for lscpserver.cpp (2.79 KB, patch)
2005-09-30 07:57 CEST, Grigor Iliev

Note You need to log in before you can comment on or make changes to this bug.
Description Grigor Iliev 2005-09-30 07:56:22 CEST
Notification messages are not send when there isn't network activity between the
LinuxSampler and its clients. The messages are delayed until the presence of
such. This mostly affects the instrument loading when the client doesn't poll
the sampler channel information on a regular basis.

The attached patch for lscpserver.cpp causes LinuxSampler to checks at least 10
times in a second for new event messages.
Comment 1 Grigor Iliev 2005-09-30 07:57:11 CEST
Created attachment 13 [details]
patch for lscpserver.cpp
Comment 2 Christian Schoenebeck 2005-10-26 10:56:40 CEST
I'm not sure anymore, but I think we had an issue with the timeout argument of 
select() and removed it from this section of the LSCP server due to this. But 
we can give it a try and see if somebody faces a problem. So go ahead and 
commit it please! 
Comment 3 Grigor Iliev 2005-10-26 11:49:13 CEST
OK, I found the old implementation in the CVS:

Yes, there is an issue there (from `man select'):

"On  Linux, the function select modifies timeout
to reflect the amount of time not slept; most
other implementations do not do this.
This causes problems both when Linux code which reads
timeout is ported to other operating systems,
and when code is ported to Linux that reuses a
struct timeval for multiple selects in a loop
without reinitializing it. Consider timeout to 
be undefined after select returns."

In those implementation after the first invocation of select
the timeout is set to 0, and than we have an endless loop, I think...
Comment 4 Christian Schoenebeck 2005-10-26 13:28:16 CEST
Is there probably an autoconf check for this implementation difference? I don't  
think we should simply use "#if LINUX" or something.  
Comment 5 Grigor Iliev 2005-10-26 13:49:20 CEST
I think that it's ok now (for all platforms) because, now, the timout variable
is set before every call to select function, so the select implementation in
this case doesn't matter. This wasn't done in the old(removed) implementation.