bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wait builtin not returning immediately when receiving a signal


From: Francis Montagnac
Subject: wait builtin not returning immediately when receiving a signal
Date: 16 Jan 2002 10:09:56 GMT

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib -g -O2
uname output: Linux kermit 2.2.18 #1 SMP Mon Sep 10 15:40:25 MEST 2001 i686 
unknown
Machine Type: i686-pc-linux-gnu

Bash Version: 2.05a
Patch Level: 0
Release Status: release

Description:

Except with SIGINT, the reception of a signal for which a trap has
been set doesn't make the wait builtin to return immediately.

According to the Signals chapter in the man page this should work.

Am i wrong?

This problem appears as well in bash 2.04.

A turn around is to make the trap action do itself what one wants in
this case (ex: from within a function, doing a return), the trap being
applied immediately.

Repeat-By:

sl() {
    local sig=$1
    (
        trap "echo $sig trapped" $sig
        sleep 10 &
        time wait $!
        echo "wait -> $?"
    ) &
    sleep 2
    kill -$sig $!
    wait $!
}

sl SIGINT
sl SIGTERM
sl SIGUSR1

-- 
Francis.Montagnac@sophia.inria.fr, Tel: (33) 04 92 38 79 11, Bur: E106
INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis Cedex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]