zlacker

[parent] [thread] 3 comments
1. ignora+(OP)[view] [source] 2025-12-03 21:23:25
> A panic + unwind in Rust is clean and _safe_, thus preferable to segfaults

Curious about safety here: Are kernel / cross-thread resources (ex: a mutex/futex/fd) released on unwind (assuming the stack being unwound acquired those)?

replies(1): >>diarrh+2d1
2. diarrh+2d1[view] [source] 2025-12-04 08:04:47
>>ignora+(OP)
Good question. For fds their Drop implementation closes them, yes. Rust Mutexes will be poisoned on panic (not unlocked). Not sure about futexes.
replies(1): >>reacto+lg6
◧◩
3. reacto+lg6[view] [source] [discussion] 2025-12-05 17:29:33
>>diarrh+2d1
But if Rust panic’s, the entire process is dead, so everything gets reclaimed on exit by the kernel. Total annihilation.

All modern OS’s behave this way. When your process starts and is assigned an address, you get an area. It can balloon but it starts somewhere. When the process ends, that area is reclaimed.

replies(1): >>diarrh+m37
◧◩◪
4. diarrh+m37[view] [source] [discussion] 2025-12-05 21:18:49
>>reacto+lg6
The OS is my GC. It's why I segfault liberally.
[go to top]