How?
-
-
-
Replying to @RichFelker
You mean adding a lock to sigaction, so abort() can prevent concurrent sigaction calls?
1 reply 0 retweets 1 like -
-
Replying to @RichFelker @sortiecat
Oddly the glibc abort() does take lock, but for synchronizing its fallback steps against concurrent calls to abort, not against sigaction. And as far as I can tell, the lock is not AS-safe...
2 replies 0 retweets 1 like -
Replying to @RichFelker
What is supposed to happen if two threads run abort() concurrently? The interesting case would be if a signal handler is installed. It runs potentially twice concurrently? Is the program supposed to mask SIGABRT except in one thread?
1 reply 0 retweets 0 likes -
Replying to @sortiecat
abort is specified to behave as if it performs raise(SIGABRT), and not to perform any termination if SIGABRT is caught and the handler does not return. I read that as allowing well-defined concurrent calls as long as the handler does not return (each thread enters a handler)...
1 reply 0 retweets 0 likes -
Replying to @RichFelker @sortiecat
Once a handler returns (observable by raise returning in the abort implementation), though, it's mandated that program termination happen as if by SIGABRT, so there's really no concurrency issue at this point. Another thread calling abort is not sequenced wrt the sigreturn, so...
2 replies 0 retweets 0 likes -
Replying to @RichFelker @sortiecat
...it's possible that a concurrent abort from another thread may still have a small window to run, but this situation is not observably different from signal handler still being about to return in the first (or abort not yet entered, if first has SIGABRT blocked).
1 reply 0 retweets 0 likes -
Replying to @RichFelker
So I think we're in an agreement that a program handling SIGABRT, which may have multiple threads (perhaps through libraries), needs to synchronize in the signal handler if it can't safely be run concurrently/multiple times.
1 reply 0 retweets 0 likes
Yes, but normally a library making threads that are supposed to be transparent to the application needs to block all signals in those threads anyway, and of course not do things that would terminate the process, which is rather non-transparent. :-)
-
-
Replying to @RichFelker
I need to write that libraries(7) manual page for Sortix that documents these best practices. I forgot what the that page was called on Linux.
0 replies 1 retweet 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.