25 using sched_retval_t = std::conditional_t<std::is_void_v<T>,
no_retval_t, T>;
30 template <
typename Fn,
typename... Args>
32 fork(std::forward<Fn>(fn), std::forward<Args>(
args)...);
35 template <
typename OnDriftForkCallback,
typename OnDriftDieCallback,
typename Fn,
typename... Args>
37 Fn&& fn, Args&&...
args) {
39 std::forward<Fn>(fn), std::forward<Args>(
args)...);
42 template <
typename W,
typename Fn,
typename... Args>
44 fork(wh, std::forward<Fn>(fn), std::forward<Args>(
args)...);
47 template <
typename OnDriftForkCallback,
typename OnDriftDieCallback,
48 typename W,
typename Fn,
typename... Args>
52 wh, std::forward<Fn>(fn), std::forward<Args>(
args)...);
61 template <
typename Fn,
typename... Args>
65 w.sched().fork(handler_,
nullptr,
nullptr,
66 1, 1, std::forward<Fn>(fn), std::forward<Args>(
args)...);
69 template <
typename OnDriftForkCallback,
typename OnDriftDieCallback,
typename Fn,
typename... Args>
71 Fn&& fn, Args&&...
args) {
74 w.sched().fork(handler_,
75 on_drift_fork_cb, on_drift_die_cb,
76 1, 1, std::forward<Fn>(fn), std::forward<Args>(
args)...);
79 template <
typename W,
typename Fn,
typename... Args>
83 w.sched().fork(handler_,
nullptr,
nullptr,
87 template <
typename OnDriftForkCallback,
typename OnDriftDieCallback,
88 typename W,
typename Fn,
typename... Args>
93 w.sched().fork(handler_,
94 on_drift_fork_cb, on_drift_die_cb,
101 if constexpr (std::is_void_v<T>) {
102 w.sched().join(handler_);
104 return w.sched().join(handler_);
109 return scheduler::is_serialized(handler_);
113 scheduler::thread_handler<sched_retval_t> handler_;
static auto & get()
Definition: util.hpp:180
Definition: thread.hpp:23
void fork(with_callback_t, OnDriftForkCallback on_drift_fork_cb, OnDriftDieCallback on_drift_die_cb, workhint< W > wh, Fn &&fn, Args &&... args)
Definition: thread.hpp:89
thread(thread &&th)=default
thread(Fn &&fn, Args &&... args)
Definition: thread.hpp:31
bool serialized()
Definition: thread.hpp:108
thread()
Definition: thread.hpp:28
void fork(with_callback_t, OnDriftForkCallback on_drift_fork_cb, OnDriftDieCallback on_drift_die_cb, Fn &&fn, Args &&... args)
Definition: thread.hpp:70
thread(with_callback_t, OnDriftForkCallback on_drift_fork_cb, OnDriftDieCallback on_drift_die_cb, Fn &&fn, Args &&... args)
Definition: thread.hpp:36
thread(const thread &)=delete
void fork(Fn &&fn, Args &&... args)
Definition: thread.hpp:62
T join()
Definition: thread.hpp:98
thread & operator=(const thread &)=delete
thread & operator=(thread &&th)=default
thread(with_callback_t, OnDriftForkCallback on_drift_fork_cb, OnDriftDieCallback on_drift_die_cb, workhint< W > wh, Fn &&fn, Args &&... args)
Definition: thread.hpp:49
void fork(workhint< W > wh, Fn &&fn, Args &&... args)
Definition: thread.hpp:80
thread(workhint< W > wh, Fn &&fn, Args &&... args)
Definition: thread.hpp:43
#define ITYR_CHECK(cond)
Definition: util.hpp:48
va_list args
Definition: util.hpp:76
Definition: aarch64.hpp:5
constexpr with_callback_t with_callback
Definition: thread.hpp:11
Definition: thread.hpp:10
Definition: thread.hpp:14
W work_new
Definition: thread.hpp:18
W work_rest
Definition: thread.hpp:19
constexpr workhint(W w1, W w2)
Definition: thread.hpp:15