From: Daniel Elstner Date: Tue, 1 Sep 2015 01:36:03 +0000 (+0200) Subject: session: Allow multiple poll FDs per event source X-Git-Tag: libsigrok-0.4.0~347 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=92248e7821d6ed98390088dab3a4edd329ef414a;hp=92248e7821d6ed98390088dab3a4edd329ef414a;p=libsigrok.git session: Allow multiple poll FDs per event source Turns out that having one event source per libusb poll FD is a bad idea. There is only a single callback for all poll FDs, and libusb expects to be called only once per poll iteration, no matter how many FDs triggered. Also, they should all share the same timeout, which should get reset on events from any polled FD. The new timeout handling made this problem apparent, as it caused the callback to be invoked multiple times on timeouts, once for each separate event source. In order to fix this, change the implementation to allow for an arbitrary number of poll FDs per event source. This number is zero for timer FDs, one for normal I/O sources, and one or more for libusb sources (Unix only). Also, on Windows, do not get an additional timeout from libusb in the event loop. This is only appropriate when polling the libusb FDs directly, which we aren't doing on Windows. ---