delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/23/19:07:10

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52NN79h62050439
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 52NN79h62050439
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=RpahyXSP
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B75D5385735D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1742771227;
bh=jcfhIfllyEzzncgynYTiuGfQwMnZBEC5s4tvDss+6EA=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=RpahyXSPn7v1K+IFZVQKWFEl0f7nllm9UBziz7GaRBwSdS9Wg6Jv1hPOUf3tumVWS
J1D09K7s2fBv9ztctHafh/Cgs/SOF5RUi7YsvBq0QdzEqdENhEm6YdhMu7Ak72pj3S
Jrcg1aWlZbI+j2YwdT5JiJycWEjvFbHrTVASLjto=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D069F3858CDB
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D069F3858CDB
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1742771201; cv=none;
b=d8KW5L0T6xlSuxY78ZwcMUTdSh7VouFY7qVCSSZWbPDe1Khdk5U5LhpctfJMZZU2ITV4B8eEURqM16LghlcmHKrv1/hgJYRQBJq0H9+VopRZ1hqdTF4uhpIecAQw0IY5k+gIB+AB8nlA6j9hUBiz0vRGra/RERQdEQQDYA383BI=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1742771201; c=relaxed/simple;
bh=4MxBiguyW/wqMIsk1ow/NDptvK5g0GBsYNkXOAf1Iig=;
h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature;
b=V5Qx7zAGdXWVpQGZV/fB1lsdwXHgIX3ifoL14q/lJPGM2XpJl7qlZcfdZAfuXvq1Pz7x8h3HM6hjPslyOd7kppReNDXbwhMJ3aFx11p+SS2J4rYQx7aEx7QLAC0/yCrPgjUU/HyVN0juDypHt2hQYE5DlEL0VreL79fB4LHoSUA=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D069F3858CDB
Message-ID: <43a42da1-433d-42fa-b018-b393177a5707@SystematicSW.ab.ca>
Date: Sun, 23 Mar 2025 17:06:38 -0600
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Deadlock when calling pthread_key_create in the destructor of a
pthread_key
To: cygwin AT cygwin DOT com
References: <TYCPR01MB1092618CD4D65CA5AA26F73FAF8A52 AT TYCPR01MB10926 DOT jpnprd01 DOT prod DOT outlook DOT com>
Autocrypt: addr=Brian DOT Inglis AT SystematicSW DOT ab DOT ca; keydata=
xjMEXopx8xYJKwYBBAHaRw8BAQdAnCK0qv/xwUCCZQoA9BHRYpstERrspfT0NkUWQVuoePbN
LkJyaWFuIEluZ2xpcyA8QnJpYW4uSW5nbGlzQFN5c3RlbWF0aWNTdy5hYi5jYT7ClgQTFggA
PhYhBMM5/lbU970GBS2bZB62lxu92I8YBQJeinHzAhsDBQkJZgGABQsJCAcCBhUKCQgLAgQW
AgMBAh4BAheAAAoJEB62lxu92I8Y0ioBAI8xrggNxziAVmr+Xm6nnyjoujMqWcq3oEhlYGAO
WacZAQDFtdDx2koSVSoOmfaOyRTbIWSf9/Cjai29060fsmdsDM44BF6KcfMSCisGAQQBl1UB
BQEBB0Awv8kHI2PaEgViDqzbnoe8B9KMHoBZLS92HdC7ZPh8HQMBCAfCfgQYFggAJhYhBMM5
/lbU970GBS2bZB62lxu92I8YBQJeinHzAhsMBQkJZgGAAAoJEB62lxu92I8YZwUBAJw/74rF
IyaSsGI7ewCdCy88Lce/kdwX7zGwid+f8NZ3AQC/ezTFFi5obXnyMxZJN464nPXiggtT9gN5
RSyTY8X+AQ==
Organization: Systematic Software
In-Reply-To: <TYCPR01MB1092618CD4D65CA5AA26F73FAF8A52@TYCPR01MB10926.jpnprd01.prod.outlook.com>
X-Stat-Signature: u84soukprkfzkm6jjx7khniasiz6arxm
X-Rspamd-Server: rspamout06
X-Rspamd-Queue-Id: 0CC272000E
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX18wRnAmOQVsm3UTrjDzuP/8e8UfLcpbAmQ=
X-HE-Tag: 1742771199-630522
X-HE-Meta: U2FsdGVkX1/ipf2C1fRa0wf5fEqbR25yJCk3LxJ855yEhaIL/07T+ubpuABnlfWdaQGpaPxDtaXPCze6LheiuD8o+Wk6OWOlZbHEsfsOZxqcrQY3fv6Vnz7wC/YYGUpwtvtvwx5kPa7wQdASvvaHxu2ZbS/A8WKv0zVyJvb6lq3xuanYFgHc8HNTYmyLp5/GN6a/ImEWFmjQe7K3DeEndfDN+P6kVdecnBUykCUc9NwaMQU3SYDYZzEyicN6NsWkRzIpkvRhRLjON0+FbowosKiKnB1c/KpS50BHp96TXdHdt+XvZ0xTPVkO52gFNDu43XqivH5oMdiyw+8LDoMGsDPl9HbvGUKORWJp+51N7BhJx8Wn8jTGfv0ebLHf1VuENvs1bkCql3EyK9YmTKi3tPKj2ec+um5JAFg5NucU0F+QB9UNTuLhGg==
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 52NN79h62050439

On 2025-03-23 06:32, Yuyi Wang via Cygwin wrote:
> It's a bug when I tried to run tests of Rust std lib. The standard
> library of Rust tries to create a new pthread_key in the destructor of a
> key created previously. Unfortunately, List::for_each locked the mutex
> before, so List_insert method cannot lock the mutex again.
> 
> I have searched though the POSIX docs and didn't find any words that one
> should not call pthread_key_create in the destructor of a pthread_key. I
> think it should be a bug of cygwin.

Destructor functions are intended to deallocate key storage at thread exit:

https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_key_create.html
"RATIONALE
Destructor Functions
Normally, the value bound to a key on behalf of a particular thread is a pointer 
to storage allocated dynamically on behalf of the calling thread. The destructor 
functions specified with pthread_key_create() are intended to be used to free 
this storage when the thread exits."

although it later says:

"There is no notion of a destructor-safe function. If an application does not 
call pthread_exit() from a signal handler, or if it blocks any signal whose 
handler may call pthread_exit() while calling async-unsafe functions, all 
functions may be safely called from destructors."

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019