Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!pacbell.com!ames!haven!adm!news From: MANNS%DBNPIB5.BITNET@cunyvm.cuny.edu (Jochen Manns, PI der Uni Bonn, 732738/3611) Newsgroups: comp.unix.questions Subject: Signal handlers and errno Message-ID: <25390@adm.brl.mil> Date: 4 Jan 91 10:25:43 GMT Sender: news@adm.brl.mil Lines: 33 Dear UNIX programmers, I got the following problem with a signal handler and the global 'errno' variable: a) there is a main program, doing something like semop or select in the form: while ( system_call() == -1 ) if ( errno != EINTR ) fatal_error(); b) now, a signal handler is installed via 'alarm', which has various tasks. Especially it may get some 'errno' from the system calls it makes. c) so, if the handler interrupts the system_call in the main this call will fail with EINTR - no problem so far. But if the handler is called again before EINTR is checked - which is possible in a heavy loaded multitasking system even when using 'alarm' - this may crash the program when it becomes a modified 'errno'. For now I keep track on 'errno' in the signal handler but I want to ask you if there is no better method to solve such problems. Is't it a general problem with handlers? Can some of you give me some hints on that problem? Jochen Manns Physikalisches Institut der Universitaet Bonn Nussallee 12 5300 Bonn 1 (Germany)