public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-44] [libstdc++] Add missing _M_try_acquire() to __platform_semaphore
@ 2021-04-21 15:18 Thomas Rodgers
0 siblings, 0 replies; only message in thread
From: Thomas Rodgers @ 2021-04-21 15:18 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
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
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-21 15:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 15:18 [gcc r12-44] [libstdc++] Add missing _M_try_acquire() to __platform_semaphore Thomas Rodgers
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).