Skip to content

Conversation

@rneswold
Copy link
Contributor

@rneswold rneswold commented Jan 3, 2026

Removes the need for the mutex in the drivers' .run() method. Also cuts, by half, the number of async tasks to run the drivers.

The functionality has been rolled into `tracing`. Who knew?
The `.run()` method in the driver API passed the set of driver
channels in a type that was protected by a mutex. There was no need
for the serialization because only the driver would be using the
channels. Back when I wrote that code, I wasn't as experienced with
Rust and so that's how I got it to work.

Looking at it not, I realize that I should be able to pass a mutable
borrow to the `.run()` method. This commit contains the following
changes:

- `.run()` now takes a mutable borrow instead of `Arc<Mutex<T>>`
- We don't need the `tracing_futures` crate; the `tracing` crate now
  supports instrumenting futures
- The number of async tasks required to support drivers has been
  reduced; the manager task runs asynchronously, but doesn't spawn a
  task for the driver. Instead, it itself calls the `.run()` method.
  It catches any panics, as well. This cuts the number of async tasks
  in half.
If a driver crashes, we need to set the driver channels into a known
state. All types returned by the `Registrator` types must implement
the `ResettableState` trait. The default implementation is to do
nothing. Most types are fine with this. Types that need to do some
resetting, can add their reset logic with this trait.
@rneswold rneswold merged commit 2c2592d into DrMemCS:main Jan 3, 2026
3 checks passed
@rneswold rneswold deleted the pull-request branch January 3, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant