]> sigrok.org Git - libsigrok.git/blobdiff - src/libsigrok-internal.h
session: Allow multiple poll FDs per event source
[libsigrok.git] / src / libsigrok-internal.h
index a937d046ff8854399bae7111b471ca8741acf797..86a6326a76f52e881315cea54f3ccdb9b26084bd 100644 (file)
@@ -721,16 +721,16 @@ struct sr_session {
 
        gboolean running;
 
-       unsigned int num_sources;
-
        /*
-        * Both "sources" and "pollfds" are of the same size and contain pairs
-        * of descriptor and callback function. We can not embed the GPollFD
-        * into the source struct since we want to be able to pass the array
-        * of all poll descriptors to g_poll().
+        * Event sources and poll FDs are stored in the same order in the
+        * the sources and pollfds arrays. However, each source may cover
+        * any number of associated poll FDs, so the indices do not match.
+        *
+        * We cannot embed the GPollFD into the source struct since we want
+        * to be able to pass the array of all poll descriptors to g_poll().
         */
-       struct source *sources;
-       GPollFD *pollfds;
+       GArray *sources;
+       GArray *pollfds;
 
        /*
         * These are our synchronization primitives for stopping the session in
@@ -744,8 +744,11 @@ struct sr_session {
 };
 
 SR_PRIV int sr_session_source_add_internal(struct sr_session *session,
-               GPollFD *pollfd, int timeout, sr_receive_data_callback cb,
-               void *cb_data, gintptr poll_object, gboolean is_usb);
+               const GPollFD *pollfds, int num_fds, int timeout,
+               sr_receive_data_callback cb, void *cb_data,
+               gintptr poll_object);
+SR_PRIV int sr_session_source_remove_internal(struct sr_session *session,
+               gintptr poll_object);
 SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
                const struct sr_datafeed_packet *packet);
 SR_PRIV int sr_session_stop_sync(struct sr_session *session);