From owner-freebsd-bugs Wed May 1 11:10:25 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7119637B405 for ; Wed, 1 May 2002 11:10:04 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g41IA4Q40474; Wed, 1 May 2002 11:10:04 -0700 (PDT) (envelope-from gnats) Date: Wed, 1 May 2002 11:10:04 -0700 (PDT) Message-Id: <200205011810.g41IA4Q40474@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Archie Cobbs Subject: Re: bin/37614: libc_r aborts when exiting thread is canceled Reply-To: Archie Cobbs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/37614; it has been noted by GNATS. From: Archie Cobbs To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/37614: libc_r aborts when exiting thread is canceled Date: Wed, 01 May 2002 11:07:46 -0700 Test case below. -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com #include #include #include #include #include #include #include static void thread_cleanup(void *arg) { sched_yield(); printf("Thread: executing cleanup...\n"); pthread_testcancel(); } static void * thread_main(void *arg) { pthread_cleanup_push(thread_cleanup, NULL); printf("Thread: sleeping 1 second...\n"); sleep(1); printf("Thread: sending SIGTERM...\n"); kill(getpid(), SIGTERM); sched_yield(); printf("Thread: exiting...\n"); return (NULL); } int main(int argc, char **argv) { pthread_t tid; sigset_t sigs; int sig; /* Spawn thread */ printf("Main: spawning thread...\n"); if ((errno = pthread_create(&tid, NULL, thread_main, NULL)) != 0) err(1, "pthread_create"); /* Wait for signal */ sigemptyset(&sigs); sigaddset(&sigs, SIGINT); sigaddset(&sigs, SIGTERM); if (sigprocmask(SIG_BLOCK, &sigs, NULL) == -1) err(1, "sigprocmask"); printf("Main: waiting for signal...\n"); if (sigwait(&sigs, &sig) == -1) err(1, "sigwait"); /* Cancel thread */ printf("Main: canceling thread...\n"); pthread_cancel(tid); /* Done */ usleep(500); printf("Main: exiting...\n"); return (0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message