aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorThomas Rodgers <rodgert@twrodgers.com>2021-04-21 08:15:16 -0700
committerThomas Rodgers <rodgert@twrodgers.com>2021-04-21 08:18:28 -0700
commit5445da1a94bb4df752209e54f4aa21702609a20a (patch)
tree344da81f015612a5f7d560b4b871616742914459 /libstdc++-v3
parent7f9b7ccf0c14ee0dafb71860a94df65d08f59f2a (diff)
downloadgcc-5445da1a94bb4df752209e54f4aa21702609a20a.zip
gcc-5445da1a94bb4df752209e54f4aa21702609a20a.tar.gz
gcc-5445da1a94bb4df752209e54f4aa21702609a20a.tar.bz2
[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.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/bits/semaphore_base.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h
index 7e3235d..35469e4 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
{