kevinmehall / nusb

A new pure-Rust library for cross-platform low-level access to USB devices.
Apache License 2.0
150 stars 15 forks source link

Thread-safety and cancel-safety #60

Closed axelkar closed 2 weeks ago

axelkar commented 2 weeks ago

Are the methods safe to use across threads and are they safe to cancel?

kevinmehall commented 2 weeks ago

Thread safety is a given in safe Rust. Most types are Send + Sync and can be used across threads.

TransferFuture is not cancel safe and documents this caveat. Use the Queue API, whose next_complete is cancel-safe.