]> sigrok.org Git - libsigrok.git/blobdiff - src/libsigrok-internal.h
USB: Remove Windows-specific event handling code
[libsigrok.git] / src / libsigrok-internal.h
index 5004fc7b630afe47afa9e5671528d88e750935fd..42ce04a67213f18d6c7077ebbe15ef79b6d3ddcc 100644 (file)
@@ -206,15 +206,6 @@ struct sr_context {
 #ifdef HAVE_LIBUSB_1_0
        libusb_context *libusb_ctx;
        gboolean usb_source_present;
-#ifdef _WIN32
-       GThread *usb_thread;
-       gboolean usb_thread_running;
-       HANDLE usb_wait_request_event;
-       HANDLE usb_wait_complete_event;
-       GPollFD usb_pollfd;
-       sr_receive_data_callback usb_cb;
-       void *usb_cb_data;
-#endif
 #endif
 };
 
@@ -718,20 +709,19 @@ struct sr_session {
        GSList *datafeed_callbacks;
        GSList *transforms;
        struct sr_trigger *trigger;
-       GTimeVal starttime;
-       gboolean running;
 
-       unsigned int num_sources;
+       gboolean running;
 
        /*
-        * 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;
-       int source_timeout;
+       GArray *sources;
+       GArray *pollfds;
 
        /*
         * These are our synchronization primitives for stopping the session in
@@ -744,6 +734,12 @@ struct sr_session {
        gboolean abort_session;
 };
 
+SR_PRIV int sr_session_source_add_internal(struct sr_session *session,
+               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);