Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jul 1995 07:21:32 -0400 (EDT)
From:      Peter Dufault <dufault@hda.com>
To:        candy@fct.kgc.co.jp (Toshihiro Kanda)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How can I block a signal?
Message-ID:  <199507101121.HAA18462@hda.com>
In-Reply-To: <199507100355.MAA25071@xxx.fct.kgc.co.jp> from "Toshihiro Kanda" at Jul 10, 95 12:55:22 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Toshihiro Kanda writes:

(...)
>   I expected it to output:
> >!block
> >unblock
> >!
>   But it output:
> >!block
> >!unblock

This works as I expect; when you unmask the signal it is delivered.
Instead of:

> 	raise(SIGUSR1);
> 	mask = sigmask(SIGUSR1);
> 	sigprocmask(SIG_UNBLOCK, &mask, NULL);   /* '!' is printed */
> 	write(2, "unblock\n", 8);                /* 'unblock\n' is printed.

Do this:

> 	raise(SIGUSR1);
> 	write(2, "unblock\n", 8);                /* 'unblock\n' is printed.
> 	mask = sigmask(SIGUSR1);
> 	sigprocmask(SIG_UNBLOCK, &mask, NULL);   /* '!' is printed */

and you'll see the signal was masked.

-- 
Peter Dufault               Real Time Machine Control and Simulation
HD Associates, Inc.         Voice: 508 433 6936
dufault@hda.com             Fax:   508 433 5267



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507101121.HAA18462>