Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2003 21:00:11 -0700 (PDT)
From:      Ted Stockwell <ted@verniernetworks.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/51949: thread in accept cannot be cancelled
Message-ID:  <200305080400.h4840Bh63824@cvs.verniernetworks.com>
Resent-Message-ID: <200305080400.h4840SjF051868@freefall.freebsd.org>

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

>Number:         51949
>Category:       bin
>Synopsis:       thread in accept cannot be cancelled
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 07 21:00:28 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ted Stockwell
>Release:        FreeBSD 4.7-RELEASE i386
>Organization:
>Environment:
>Description:
A thread in a blocking accept() does not terminate
if cancelled with pthread_cancel().

>How-To-Repeat:
>Fix:
--- uthread_accept.c.orig       Tue Apr 29 01:40:14 2003
+++ uthread_accept.c    Wed May  7 18:42:37 2003
@@ -106,7 +106,21 @@
        }
        /* Return the socket file descriptor or -1 on error: */
        return (ret);
 }
 
-__strong_reference(_accept, accept);
+/*
+ * Cancelled threads were stuck in accept().  Code below is 
+ * patterned after uthread_select.c
+ */
+int
+accept(int fd, struct sockaddr * name, socklen_t *namelen)
+{
+       int ret;
+
+       _thread_enter_cancellation_point();
+       ret = _accept(fd, name, namelen);
+       _thread_leave_cancellation_point();
+
+       return ret;
+}
 #endif
>Release-Note:
>Audit-Trail:
>Unformatted:



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