From owner-freebsd-threads@freebsd.org Tue Aug 6 08:55:30 2019 Return-Path: Delivered-To: freebsd-threads@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06117BCE32; Tue, 6 Aug 2019 08:55:30 +0000 (UTC) (envelope-from freebsd.ed.lists@sumeritec.com) Received: from out2-4.antispamcloud.com (out2-4.antispamcloud.com [185.201.17.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 462pPW1p9kz3LFs; Tue, 6 Aug 2019 08:55:26 +0000 (UTC) (envelope-from freebsd.ed.lists@sumeritec.com) Received: from srv31.niagahoster.com ([153.92.8.106]) by mx61.antispamcloud.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1huvFa-0005G8-RA; Tue, 06 Aug 2019 10:55:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sumeritec.com; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EwnC35JO4FhhhHW/FzcI6phBcPsbGkG4cAuQaQ3DX4Q=; b=LWne+MBWQUEKiwiq3EzeAo8C6b 37g/yKVMWSu2ssitLXBkjkYoOPz9LbtM/ux1NvnaPqC3mEzekFPMnquyLsRjlUkVdXS7zxaeIQBug fYY0fYYMHMwxVneKTaIWxolyRZlmZfT2bC5c3IRVFwgIleypzuUWQudnLpdr3BJM1U3GQve9NxHCF ZohzUSn6e4/VMECyDeg/QsItOxUMdPqoNx0QKio+AQbDv9ripwurrbsUfdCTln7epGgZPjMvDZGCQ 2WK6bviMKsoFyck48McHPn3ObijQjgAt16eDagLTW+wN5fwuRSLIMSkUY18+3b8zVm1BIYRZxEYkt NlOo1D8w==; Received: from [114.125.104.25] (port=53151 helo=Ryzen1.sumeritec.com) by srv31.niagahoster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1huvEk-0008lu-Jf; Tue, 06 Aug 2019 15:54:36 +0700 Date: Tue, 6 Aug 2019 16:54:29 +0800 From: Erich Dollansky To: freebsd-threads@freebsd.org Cc: freebsd-questions@freebsd.org Subject: mutex held in a thread which is cancelled stays busy Message-ID: <20190806165429.14bc4052.freebsd.ed.lists@sumeritec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-1.0 X-AuthUser: freebsd.ed.lists@sumeritec.com X-Originating-IP: 153.92.8.106 X-Spampanel-Domain: out.niagahoster.com X-Spampanel-Username: niaga X-Spampanel-Outgoing-Class: unsure X-Spampanel-Outgoing-Evidence: Combined (0.15) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0YiRRkpbHZ8F3zevhEShTfypSDasLI4SayDByyq9LIhVUZbR67CQ7/vm /hHDJU4RXkTNWdUk1Ol2OGx3IfrIJKyP9eGNFz9TW9u+Jt8z2T3Kht+IZhY6ch0O83RbO74UuchG FjsEC1XQn4kD580oZ36VWj3N+DNDhaWbf5bdQc5fT1WcYtDP/4y2NaPLrBX+bUGlz8CJSOMrvzx9 TVg3RkVXXAbgwJTs9OPCd7ZRQeo+p8jZ4AoGBlDR94YkH0RjFQmsAcf1kLoKapRG7lc9JeDN7KHQ l3eg3qrfFG24mhAbgq187NiIKOf+KSg+XppMqz7bfuwlcJJEKTupS5XvURwhEWyJzIkwSFAW0Pw8 uiKeMUJTS2Jsxpkx+IHIsDarm2Hx5e4YMH5a+Vxo+Gz4gw56nrUo2iUXYOUfZrYt2kwya2u/aJSy +XYIL3TVXRgGu+ISfO+8Nwazmqab1cMTal0k88rkq0CsLjZ84JRIA6Ye/ajVf3YKfhRT0knXt1CR LuLMOPhV8sZiFXmtTilamlYRFmMy/B+9uFk6vL63wFNT/iH+i0krVjPg4j89ZZyO7mN7AnWnYo04 a2ey4hx/dv+muc596OjLSvKX9IT2wJHgmTBPB3ojkwVz5nkXGxmpgHMcN6qoXPjenLhIOF1oeRbs um4BtTmK88nRNTFa+st+XaoInkRdNlt33zOhWO9WO54rOm8qiHFF9QDz4mC1Fk6A4C3fxV8V8Cbn AWESwbg6xu2OfQrGyuxJBL08Tx1B6MUXC2YrxA3JqQGzPWUXNAL5luHEIOz7YnQP9uRZXMDdNgA/ bvpxeniqBDKdL+6MGbK4t8eoCcCPuuAofv54KaZJD4BSWMbTv4/F9nZCflAXVKFwDpe+9rZABUSO mrMA1sfhtY1GZZolCkLnLN7c0R+MPCdbWjlZ4FwOnzX+Io4BoxTkj0hGlATQgXlJtJ0i5pE2QAQR POB84MmsDrk3yRlOP34VGRo5L8M2MA2Zvy07rVJth1gDB2lpXMdbvAc7tiERbInMiTBIUBbQ/Dy6 Ip65tyiUWX+tf7ZF5CSWokMB/eSqQACX6tONkFbPlnFTwFrgPv9TQfT8VfEBrwtfkhA= X-Report-Abuse-To: spam@quarantine10.antispamcloud.com X-Rspamd-Queue-Id: 462pPW1p9kz3LFs X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=sumeritec.com header.s=default header.b=LWne+MBW; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd.ed.lists@sumeritec.com has no SPF policy when checking 185.201.17.4) smtp.mailfrom=freebsd.ed.lists@sumeritec.com X-Spamd-Result: default: False [-1.77 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[sumeritec.com:s=default]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[sumeritec.com]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.45)[ipnet: 185.201.17.0/24(-1.92), asn: 49544(-0.34), country: NL(0.01)]; DKIM_TRACE(0.00)[sumeritec.com:+]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_SHORT(-0.93)[-0.925,0]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[4.17.201.185.list.dnswl.org : 127.0.3.1]; RECEIVED_SPAMHAUS_PBL(0.00)[25.104.125.114.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:49544, ipnet:185.201.17.0/24, country:NL]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 08:55:30 -0000 Hi, for testing purpose, I did the following. Start a thread, initialise a mutex in a global variable, lock the mutex and wait in that thread. Wait in the main program until above's thread waits and cancel it. Clean up behind the cancelled thread but leave intentional the mutex locked. I would have expected now to get an error like 'EOWNERDEAD' doing operations with that mutex. But I get 'EBUSY' as the error. Of course, the program is not able to do any thing with that mutex. Where is the misunderstanding? Erich