On 17/07/2023 15:02, Corinna Vinschen wrote: > >> We can't neatly tuck the pthread_cleanup_push/pop inside the object, as >> they are implemented as macros which must appear in the same lexical >> scope. > > You could do it if you call the underlying functions instead. > pthread_cleanup_push is just a convenience macro which initializes a > local __pthread_cleanup_handler, see include/pthread.h. If you add a > __pthread_cleanup_handler to system_call_handle, you could use it the > same way as the macro and encapsulate the whole thing inside the object. > If you want to... Good point. Yeah, this seems preferable as it doesn't move the point where we restore the signal handlers in the normal flow of execution, which might be important, still happening when the system_call_handle object falls out of scope and is destroyed. > > Fixes and Signed-off-by tags? > Done. Revised patch attached.