public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Rodgers <rodgertq@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-44] [libstdc++] Add missing _M_try_acquire() to __platform_semaphore Date: Wed, 21 Apr 2021 15:18:45 +0000 (GMT) [thread overview] Message-ID: <20210421151845.B931B3846074@sourceware.org> (raw) https://gcc.gnu.org/g:5445da1a94bb4df752209e54f4aa21702609a20a commit r12-44-g5445da1a94bb4df752209e54f4aa21702609a20a Author: Thomas Rodgers <rodgert@twrodgers.com> Date: Wed Apr 21 08:15:16 2021 -0700 [libstdc++] Add missing _M_try_acquire() to __platform_semaphore libstdc++-v3/ChangeLog: * include/bits/semaphore_base.h: Add missing _M_try_acquire() member to __platform_wait. Diff: --- libstdc++-v3/include/bits/semaphore_base.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h index 7e3235d182e..35469e443b0 100644 --- a/libstdc++-v3/include/bits/semaphore_base.h +++ b/libstdc++-v3/include/bits/semaphore_base.h @@ -86,6 +86,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } + _GLIBCXX_ALWAYS_INLINE bool + _M_try_acquire() noexcept + { + for (;;) + { + auto __err = sem_trywait(&_M_semaphore); + if (__err && (errno == EINTR)) + continue; + else if (__err && (errno == EAGAIN)) + return false; + else if (__err) + std::terminate(); + else + break; + } + return true; + } + _GLIBCXX_ALWAYS_INLINE void _M_release(std::ptrdiff_t __update) noexcept {
reply other threads:[~2021-04-21 15:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210421151845.B931B3846074@sourceware.org \ --to=rodgertq@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).