immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.95k stars 234 forks source link

Switch to crossbeam-queue for events #1091

Closed ahomescu closed 3 months ago

ahomescu commented 4 months ago

Use a lock-free queue to store the event list because the event callbacks might be called from inside a signal handler. Most system calls are not safe in that context, so we just spin if the queue is full.

spernsteiner commented 4 months ago

What's left to do here?

Edit: Should I go audit all the functions in the runtime and check exactly which ones need to be signal-safe? Shouldn't be too hard.

@ahomescu, did you already do this / do you still plan to?

ahomescu commented 3 months ago

What's left to do here?

Edit: Should I go audit all the functions in the runtime and check exactly which ones need to be signal-safe? Shouldn't be too hard.

@ahomescu, did you already do this / do you still plan to?

I added a bunch of comments on signal safety, and removed a few potentially unsafe eprintln! calls.