[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.
This commit is contained in:
parent
7f9b7ccf0c
commit
5445da1a94
1 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue