fairness  v1.0.0
A collection of advanced syncronization mechanisms.
Loading...
Searching...
No Matches
wait_ops_linux.hpp
Go to the documentation of this file.
1
14#ifndef BOOST_FAIRNESS_WAIT_OPS_LINUX_HPP
15#define BOOST_FAIRNESS_WAIT_OPS_LINUX_HPP
17#include <unistd.h>
18#include <linux/futex.h>
19#include <sys/syscall.h>
20#include <limits.h>
21
23
24 template<typename T, typename K>
25 inline void wait_(T& mem, K expected){
26 static_assert(sizeof(T) == 4, "Invalid argument size on boost::fairness::detail::wait");
27 syscall(SYS_futex, &mem, FUTEX_WAIT_PRIVATE, expected, nullptr, nullptr, 0);
28 }
29
30 template<typename T>
31 inline void notify_one_(T& mem){
32 static_assert(sizeof(T) == 4, "Invalid argument size on boost::fairness::detail::notify_one");
33 syscall(SYS_futex, &mem, FUTEX_WAKE_PRIVATE, 1, nullptr, nullptr, 0);
34 }
35
36 template<typename T>
37 inline void notify_all_(T& mem){
38 static_assert(sizeof(T) == 4, "Invalid argument size on boost::fairness::detail::notify_all");
39 syscall(SYS_futex, &mem, FUTEX_WAKE_PRIVATE, INT_MAX, nullptr, nullptr, 0);
40 }
41
42}
43
44#endif // BOOST_FAIRNESS_WAIT_OPS_LINUX_HPP
This file contains configurations about boost and 128bit cpu support. TODO.
Definition coherent_priority_lock.hpp:25
void wait_(T &mem, K expected)
Definition wait_ops_generic.hpp:22
void notify_one_(T &mem)
Definition wait_ops_generic.hpp:31
void notify_all_(T &mem)
Definition wait_ops_generic.hpp:40