From owner-freebsd-bugs Wed Jun 7 1:40:21 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id CF18A37BD20 for ; Wed, 7 Jun 2000 01:40:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA53778; Wed, 7 Jun 2000 01:40:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id CCB5037B8B2; Wed, 7 Jun 2000 01:38:25 -0700 (PDT) Message-Id: <20000607083825.CCB5037B8B2@hub.freebsd.org> Date: Wed, 7 Jun 2000 01:38:25 -0700 (PDT) From: bryanm@is.co.za To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/19087: selects always restart when using threads Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 19087 >Category: misc >Synopsis: selects always restart when using threads >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jun 07 01:40:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Bryan Mawhinney >Release: 4.0-RELEASE >Organization: The Internet Solution >Environment: FreeBSD some.host 4.0-RELEASE FreeBSD 4.0-RELEASE #2: Thu May 18 16:27: 16 SAST 2000 bryanm@is.co.za:/usr/src/sys/compile/VISP i386 >Description: Threads blocking on select default to being restarted after signals. Shouldn't the default be to interrupt, given that these are POSIX threads? Calling siginterrupt(1) doesn't help, since it isn't thread aware. One has to use sigaction to explicity set sa_flags to 0 to get the POSIX behaviour. >How-To-Repeat: In a threaded app (eg, slapd from openldap-1.2.10): int shutdown = 0; signal( SIGTERM, set_shutdown) while (!shutdown) { i = select( nfds, &readfds, &writefds, 0, 0) ... } void set_shutdown( int sig ) { shutdown = 1 } In response to a SIGTERM, shutdown is set to 1, but if the fds are idle, the process never exits because the select restarts each time. >Fix: libc_r includes an implementation of signal which implements the POSIX semantics, but it is not listed in HIDDEN_SYSCALLS, so the libc implementation gets used anyway. Is this an oversight, or is this merely a porting issue? Are there any other side effects due to calling the libc signal? >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message