From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 552FE3858020; Thu, 23 Feb 2023 13:48:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 552FE3858020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677160094; bh=2eE5jwUFs+PETscK4Gm8HPEnopw/MRg9VvrtKXkB0yk=; h=From:To:Subject:Date:From; b=YujF2s6il3ZkijLSOGm/G7cDHADziRjdwnhJdTKyrf3GwIqTGTbnffW9AeJ6Yj+S9 zfxFWKALXQthLYaQe1tL/nlW6S3vErX28zU7czQqZyVl9rji8AEMjMS3ugn/7c2vOj tStmpX094KHhDMHclwEYnc8x120t79/5WEFVO7cs= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] [libstdc++] do not destruct mutex_pool mutexes X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: d310aa27168fef00664081fa96556a03a43f0ca1 X-Git-Newrev: bb924c8f32b64ba6b381e46c434e0c8c0acb0291 Message-Id: <20230223134814.552FE3858020@sourceware.org> Date: Thu, 23 Feb 2023 13:48:14 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bb924c8f32b64ba6b381e46c434e0c8c0acb0291 commit bb924c8f32b64ba6b381e46c434e0c8c0acb0291 Author: Alexandre Oliva Date: Thu Feb 23 10:30:22 2023 -0300 [libstdc++] do not destruct mutex_pool mutexes On vxworks, after destroying the semaphore used to implement a mutex, __gthread_mutex_lock fails and __gnu_cxx::__mutex::lock calls __throw_concurrence_lock_error. Nothing ensures the mutex_pool mutexes survive init-once objects containing _Safe_sequence_base. If such an object completes construction before mutex_pool initialization, it will be registered for atexit destruction after the mutex_pool mutexes, so the _M_detach_all() call in the _Safe_sequence_base dtor will use already-destructed mutexes, and basic_string/requirements/citerators_cc fails calling terminate. This patch fixes this problem by ensuring the mutex pool mutexes are constructed on demand, on a statically-allocated buffer, but never destructed. for libstdc++-v3/ChangeLog * src/c++11/shared_ptr.cc (__gnu_internal::get_mutex): Avoid destruction of the mutex pool. Diff: