Skip to content

Commit

Permalink
Add Context::interrupt_handle_events()
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  • Loading branch information
elmarco committed Aug 11, 2021
1 parent fb0940c commit 976e7c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions libusb1-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ extern "system" {
completed: *mut c_int,
) -> c_int;
pub fn libusb_handle_events_locked(context: *mut libusb_context, tv: *const timeval) -> c_int;
pub fn libusb_interrupt_event_handler(context: *mut libusb_context);

pub fn libusb_try_lock_events(context: *mut libusb_context) -> c_int;
pub fn libusb_lock_events(context: *mut libusb_context);
Expand Down
6 changes: 6 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ pub trait UsbContext: Clone + Sized + Send + Sync {
}
}

fn interrupt_handle_events(&self) {
unsafe {
libusb_interrupt_event_handler(self.as_raw())
}
}

fn next_timeout(&self) -> crate::Result<Option<Duration>> {
let mut tv = timeval { tv_sec: 0, tv_usec: 0 };
let n = unsafe {
Expand Down

0 comments on commit 976e7c8

Please sign in to comment.