bin/51949: thread in accept cannot be cancelled

Ted Stockwell ted at verniernetworks.com
Wed May 7 21:00:30 PDT 2003


>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:


More information about the freebsd-bugs mailing list