Robin Lee Powell scripsit: > > uh oh - running Scheme callbacks in interrupt handlers is > > dangerous: the set of libc functions that may be called inside > > them is restricted, and this is likely to highly risky. > > Can you expand on this a bit?
It's a C restriction, not a Chicken one. Basically, the C library (glibc or whatever) is not guaranteed to be reentrant and generally is not. That is, once one thread is inside the library, another thread can't enter the library until the first has exited, but this is not enforced -- your program just goes kablooey. For this purpose, interrupt handlers are a separate thread of control. The only absolutely guaranteed safely callable functions are abort, _Exit (not the same as _exit or exit), and signal with the first argument equal to the signal number that caused this handler to be entered. In practice, longjmp is not a problem either, though that's not an option in Chicken. Most signal handlers just set a global variable to 1 and return. -- John Cowan [EMAIL PROTECTED] http://ccil.org/~cowan "The exception proves the rule." Dimbulbs think: "Your counterexample proves my theory." Latin students think "'Probat' means 'tests': the exception puts the rule to the proof." But legal historians know it means "Evidence for an exception is evidence of the existence of a rule in cases not excepted from." _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
