Lely core libraries
2.3.4
strand.hpp
Go to the documentation of this file.
1
24
#ifndef LELY_EV_STRAND_HPP_
25
#define LELY_EV_STRAND_HPP_
26
27
#include <
lely/ev/exec.hpp
>
28
#include <
lely/ev/strand.h
>
29
#include <
lely/util/error.hpp
>
30
31
#include <utility>
32
33
namespace
lely {
34
namespace
ev {
35
37
class
Strand
:
public
Executor
{
38
public
:
40
explicit
Strand
(
Executor
inner_exec)
41
:
Executor
(
ev_strand_create
(inner_exec)) {
42
if
(!exec_) ::lely::util::throw_errc(
"Strand"
);
43
}
44
45
Strand
(
const
Strand
&) =
delete
;
46
47
Strand
(
Strand
&& other) noexcept :
Executor
(other) { other.exec_ =
nullptr
; }
48
49
Strand
& operator=(
const
Strand
&) =
delete
;
50
51
Strand
&
52
operator=(
Strand
&& other) noexcept {
53
using ::std::swap;
54
swap(exec_, other.exec_);
55
return
*
this
;
56
}
57
59
~Strand
() {
ev_strand_destroy
(exec_); }
60
62
Executor
63
get_inner_executor
() const noexcept {
64
return
Executor
(
ev_strand_get_inner_exec
(*
this
));
65
}
66
};
67
68
}
// namespace ev
69
}
// namespace lely
70
71
#endif // !LELY_EV_STRAND_HPP_
strand.h
lely::ev::Strand
A strand executor.
Definition:
strand.hpp:37
lely::ev::Strand::Strand
Strand(Executor inner_exec)
Definition:
strand.hpp:40
lely::ev::Executor
An abstract task executor. This class is a wrapper around #ev_exec_t*.
Definition:
exec.hpp:38
ev_strand_create
ev_exec_t * ev_strand_create(ev_exec_t *inner_exec)
Creates a strand executor.
Definition:
strand.c:153
ev_strand_get_inner_exec
ev_exec_t * ev_strand_get_inner_exec(const ev_exec_t *exec)
Returns a pointer to the inner executor of a strand.
Definition:
strand.c:189
lely::ev::Strand::~Strand
~Strand()
Definition:
strand.hpp:59
lely::ev::Strand::get_inner_executor
Executor get_inner_executor() const noexcept
Definition:
strand.hpp:63
exec.hpp
ev_strand_destroy
void ev_strand_destroy(ev_exec_t *exec)
Destroys a strand executor.
Definition:
strand.c:180
error.hpp
include
lely
ev
strand.hpp
Generated by
1.8.17