Amanieu / parking_lot

Compact and efficient synchronization primitives for Rust. Also provides an API for creating custom synchronization primitives.
Apache License 2.0
2.77k stars 217 forks source link

feat(wasm-bindgen): deadlock detector support #379

Closed samdenty closed 1 year ago

samdenty commented 1 year ago

This adds deadlock_detector support for the WASM target.

Instead of thread_id I added a conditional worker_name field

samdenty commented 1 year ago

pinging @Amanieu in case you didn't see it 🙂

Amanieu commented 1 year ago

LGTM, can you squash the commits?

samdenty commented 1 year ago

@Amanieu squashed 🙏

daxpedda commented 1 year ago

I'm surprised worker names are used as an identifier here, worker names are not unique in any way and often left empty. So this deadlock detector will just not work most of the time.

Would a PR be acceptable that simply uses an atomic thread counter?

daxpedda commented 1 year ago

After looking at this PR again, I noticed that it used cfg(target = "..."), which is currently an unstable feature (RFC), which wasn't activated.

Additionally, it wasn't caught because the build_other_platforms CI, the only one testing Wasm, didn't test this feature.