Hacker News new | ask | show | jobs
by the_mitsuhiko 3581 days ago
> This is false, you can call any async signal safe function. Incidentally write is one of them.

Which malloc() is not. Anything that might internally allocate is out of the question. The list of functions that are safe to call in C alone is very limited and even then the question of errno arises.

1 comments

why are you bringing up malloc?
Because you do not necessarily know which call will allocate memory in Rust and even in C it can be tricky. You literally can only go with the whitelisted functions.
Yes, that's way you should, as I suggested, only call functions explicitly documented as asyc-signal-safe.