mirror of
https://github.com/boostorg/fiber.git
synced 2026-07-21 13:13:32 +00:00
Merge pull request #315 from brad0/boost_fiber_futex_openbsd
futex: add support for OpenBSD
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
# include <boost/config/auto_link.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX || BOOST_OS_WINDOWS
|
||||
#if BOOST_OS_LINUX || BOOST_OS_BSD_OPEN || BOOST_OS_WINDOWS
|
||||
# define BOOST_FIBERS_HAS_FUTEX
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ extern "C" {
|
||||
#include <linux/futex.h>
|
||||
#include <sys/syscall.h>
|
||||
}
|
||||
#elif BOOST_OS_BSD_OPEN
|
||||
extern "C" {
|
||||
#include <sys/futex.h>
|
||||
}
|
||||
#elif BOOST_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -29,10 +33,21 @@ namespace boost {
|
||||
namespace fibers {
|
||||
namespace detail {
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_BSD_OPEN
|
||||
BOOST_FORCEINLINE
|
||||
int sys_futex( void * addr, std::int32_t op, std::int32_t x) {
|
||||
#if BOOST_OS_BSD_OPEN
|
||||
return ::futex
|
||||
(
|
||||
static_cast< volatile uint32_t* >(addr),
|
||||
static_cast< int >(op),
|
||||
x,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
#else
|
||||
return ::syscall( SYS_futex, addr, op, x, nullptr, nullptr, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
|
||||
Reference in New Issue
Block a user