From: Steve G <lin...@ya...> - 2003-07-03 11:42:43
|
>And maybe I should use the term "signal safe" when talking >about functions that can be called from signal handlers, >rather than "reentrant"? Or are they the same thing? They are different. A function that is re-entrant is one that may be called by a different thread of execution concurrently and it won't cause any ill effects. Signal safe means that the function is not using static data buffers, not using library data structures that may be in unsafe state, and only calling functions that are in the whitelist or functions composed of those on the whitelist. Signal handlers should be both signal-safe and re-entrant. Common functions in a Pthreads program should be re-entrant. Glad to see other people finding bugs in signal handlers. This was the area of most problems in a lot of code reviews I've been doing. I'm reviewing some code from freeradius right now and its sigchld signal handler does bad things...which might explain why it crashes after 6-7 days of heavy use. Fixing signal handlers is simple once you are aware of a problem. It seems people were not aware. -Steve Grubb __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com |