[sigrok-devel] [PATCH 2/4] sr: session: Keep a global pollfd array

2012-06-30 Thread Lars-Peter Clausen
Currently we keep a file descriptor for each source and construct a pollfd array from these during each loop iteration in sr_session_run(). This patch modifies the code to keep a global pollfd array which is only modified when a source is added or removed. On one hand this gets rid of the constant

[sigrok-devel] [PATCH 3/4] sr: session: Add support for GPollFD or GIOChannel based sources

2012-06-30 Thread Lars-Peter Clausen
A raw file descriptor to poll on is not always available, this patch adds support for adding a source for a GIOChannel or GPollFD. Signed-off-by: Lars-Peter Clausen --- libsigrok/session.c | 164 +- libsigrok/sigrok-proto.h |6 ++ 2 files cha

[sigrok-devel] [PATCH 4/4] sr: session/demo: Remove Windows specific hack

2012-06-30 Thread Lars-Peter Clausen
The session and demo device code contain a hack to make the demo device work on Windows. This was neccessary since polling on windows requires special handling and we can not just pass in the raw fd to poll. With the previous patches which added support for non-fd based event sources this hack is

[sigrok-devel] [PATCH 1/4] sr: session: Use realloc to resize source array

2012-06-30 Thread Lars-Peter Clausen
Use realloc to resize the source array when adding or removing a source. This makes the code a bit smaller. In the remove function we now check whether the fd is valid before doing anything else and if it is not simply do nothing. If it is valid use memove to move the elements following the source