Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2002 09:50:47 -0800 (PST)
From:      Torbjorn Granlund <tege@swox.se>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/33951: pthread_cancel is ignored
Message-ID:  <200201161750.g0GHol986467@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         33951
>Category:       kern
>Synopsis:       pthread_cancel is ignored
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 16 10:00:08 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Torbjorn Granlund
>Release:        4.4 (and 4.1, 4.2, 4.3)
>Organization:
Swox AB
>Environment:
FreeBSD hill.swox.se 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Tue Sep 18 11:57:08 PDT 2001     murray@builder.FreeBSD.org:/usr/src/sys/compile/GENERIC  i386

>Description:
pthread_cancel doesn't work properly.
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0)
does not seem to make any difference.
>How-To-Repeat:
Compile and run the program below.  On machines with properly working
pthreads implementations, five CPU seconds are consumed, then the
program just sleeps.  Using FreeBSD, the created thread keeps crunching
until process termination.

#include <pthread.h>
#include <unistd.h>

void *
crunch(void *ignored)
{
  pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);

  for (;;)
    ;
}

int
main()
{
  pthread_t thread;

  pthread_create(&thread, NULL, crunch, 0);
  sleep (5);
  pthread_cancel(thread);
  sleep (100);
  return 0;
}

>Fix:
None.  We have to tell our customer to run the program on any Unix
system except FreeBSD until this is fixed.

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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