2 ms·
You do not know which lock it was holding though; when handling a segfault for example you need to be pessimistic and assume that you can't touch any lock (thin
by gpderetta 10y ago
You do not know which lock it was holding though; when handling a segfault for example you need to be pessimistic and assume that you can't touch any lock (think of the allocator lock for example).
Async signal safety implies both reentrancy and non blocking algorithms [1]. You might not need reentrancy but you do need non-blocking. That's really a significant restriction as libraries with non-blocking guarantees are rare.
- JoshTriplett 10y agoDepending on the nature of your segfault handler, you could either make sure you have any data structures you need already allocated, or allocate out of a separate arena. Or, alternatively, handle the signal in another process entirely.
- gpderetta 10y agoI.e. it is safe as long as you follow the same rules you would use in a normal signal handler :). Out of process handling is a robust solution though.