From owner-freebsd-threads@FreeBSD.ORG Wed Dec 22 04:30:35 2004 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E30816A4CE for ; Wed, 22 Dec 2004 04:30:35 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 32CFB43D2F for ; Wed, 22 Dec 2004 04:30:35 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iBM4UZcB074829 for ; Wed, 22 Dec 2004 04:30:35 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iBM4UZaY074828; Wed, 22 Dec 2004 04:30:35 GMT (envelope-from gnats) Date: Wed, 22 Dec 2004 04:30:35 GMT Message-Id: <200412220430.iBM4UZaY074828@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Enoch W." Subject: Re: threads/75273: FBSD 5.3 libpthread (KSE) bug X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "Enoch W." List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2004 04:30:35 -0000 The following reply was made to PR threads/75273; it has been noted by GNATS. From: "Enoch W." To: , Cc: Subject: Re: threads/75273: FBSD 5.3 libpthread (KSE) bug Date: Tue, 21 Dec 2004 23:26:28 -0500 This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C4E7B4.7F0A0870 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0003_01C4E7B4.7F0B8F10" ------=_NextPart_001_0003_01C4E7B4.7F0B8F10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Problem demo is attached, as requested. TIA, Enoch. ------=_NextPart_001_0003_01C4E7B4.7F0B8F10 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Problem demo is attached, as requested. = TIA,=20 Enoch.
------=_NextPart_001_0003_01C4E7B4.7F0B8F10-- ------=_NextPart_000_0002_01C4E7B4.7F0A0870 Content-Type: application/octet-stream; name="demo.c" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="demo.c" #include =0A= #include =0A= #include =0A= #include =0A= #include =0A= #include =0A= =0A= #define ASSRET(cond) do { \=0A= if (!(cond)) { \=0A= fprintf(stderr, "ASSRET ERROR @ %d -> %s\n", __LINE__, \=0A= strerror(ret =3D=3D -1 ? errno : ret)); \=0A= exit(EXIT_FAILURE); \=0A= } \=0A= } while (0)=0A= =0A= int tock;=0A= =0A= void tick()=0A= {=0A= tock =3D 1;=0A= }=0A= =0A= void *pulse(void *arg)=0A= {=0A= int ret;=0A= struct itimerval it;=0A= sigset_t set;=0A= =0A= sigemptyset(&set);=0A= sigaddset(&set, SIGALRM);=0A= ret =3D sigprocmask(SIG_BLOCK, &set, NULL);=0A= ASSRET(ret =3D=3D 0);=0A= sigemptyset(&set);=0A= =0A= it.it_interval.tv_sec =3D 1;=0A= it.it_interval.tv_usec =3D 0;=0A= it.it_value.tv_sec =3D 1;=0A= it.it_value.tv_usec =3D 0;=0A= ret =3D setitimer(ITIMER_REAL, &it, NULL);=0A= ASSRET(ret =3D=3D 0);=0A= =0A= while (1) {=0A= while (!tock)=0A= sigsuspend(&set);=0A= tock =3D 0;=0A= putchar('*');=0A= fflush(stdout);=0A= }=0A= }=0A= =0A= int main()=0A= {=0A= int ret;=0A= pthread_attr_t attr;=0A= pthread_t thread;=0A= =0A= ret =3D pthread_attr_init(&attr);=0A= ASSRET(ret =3D=3D 0);=0A= ret =3D pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);=0A= ASSRET(ret =3D=3D 0);=0A= =0A= signal(SIGALRM, tick);=0A= =0A= ret =3D pthread_create(&thread, NULL, pulse, NULL);=0A= ASSRET(ret =3D=3D 0);=0A= =0A= printf("Press Enter to cancel the pulse() thread\n");=0A= while (getchar() !=3D '\n');=0A= =0A= ret =3D pthread_cancel(thread);=0A= ASSRET(ret =3D=3D 0);=0A= ret =3D pthread_join(thread, NULL);=0A= ASSRET(ret =3D=3D 0);=0A= =0A= printf("Press Enter to end\n");=0A= while (getchar() !=3D '\n');=0A= return 0;=0A= }=0A= ------=_NextPart_000_0002_01C4E7B4.7F0A0870 Content-Type: application/octet-stream; name="demo.mk" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="demo.mk" demo: demo.c=0A= $(CC) -Wall -g -odemo -pthread demo.c=0A= ------=_NextPart_000_0002_01C4E7B4.7F0A0870--