From owner-freebsd-threads@FreeBSD.ORG Mon May 24 14:14:47 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F3A01065676; Mon, 24 May 2010 14:14:47 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from freefall.freebsd.org (unknown [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 46FFC8FC1F; Mon, 24 May 2010 14:14:47 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o4OEElQa072399; Mon, 24 May 2010 14:14:47 GMT (envelope-from kan@freefall.freebsd.org) Received: (from kan@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o4OEEkch072395; Mon, 24 May 2010 14:14:46 GMT (envelope-from kan) Date: Mon, 24 May 2010 14:14:46 GMT Message-Id: <201005241414.o4OEEkch072395@freefall.freebsd.org> To: cfishwu@corp.netease.com, kan@FreeBSD.org, freebsd-threads@FreeBSD.org From: kan@FreeBSD.org Cc: Subject: Re: threads/146917: open(), accept() are not thread safe X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2010 14:14:47 -0000 Synopsis: open(), accept() are not thread safe State-Changed-From-To: open->feedback State-Changed-By: kan State-Changed-When: Mon May 24 14:08:42 UTC 2010 State-Changed-Why: Your explanation of what application is doing is not complete and it is totally not clear what is that you are trying to do. The error code you getting is EBADF, which suggests that one thread has likely closed the handle other thread still uses. That or some other bug in you application is likely causing what you are seeing - open, close and write are certainly 'thread safe', as there is no global state to protect. http://www.freebsd.org/cgi/query-pr.cgi?pr=146917