From owner-freebsd-questions Mon Jul 10 04:24:41 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id EAA05737 for questions-outgoing; Mon, 10 Jul 1995 04:24:41 -0700 Received: from hda.com (hda.com [199.232.40.182]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id EAA05731 for ; Mon, 10 Jul 1995 04:24:36 -0700 Received: (dufault@localhost) by hda.com (8.6.11/8.3) id HAA18462; Mon, 10 Jul 1995 07:21:33 -0400 From: Peter Dufault Message-Id: <199507101121.HAA18462@hda.com> Subject: Re: How can I block a signal? To: candy@fct.kgc.co.jp (Toshihiro Kanda) Date: Mon, 10 Jul 1995 07:21:32 -0400 (EDT) Cc: freebsd-questions@freebsd.org In-Reply-To: <199507100355.MAA25071@xxx.fct.kgc.co.jp> from "Toshihiro Kanda" at Jul 10, 95 12:55:22 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 795 Sender: questions-owner@freebsd.org Precedence: bulk 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