⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
userver
C++ Async Framework v2.0
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
▼
userver
Documentation
►
API Groups
►
Namespaces
▼
Reference
►
Namespace Members
►
Class List
Class Index
►
Class Hierarchy
►
Class Members
▼
File List
►
en
►
testsuite
►
userver
▼
userver
►
alerts
►
baggage
►
cache
►
clients
►
components
►
concurrent
►
congestion_control
►
dist_lock
►
drivers
►
dump
►
dynamic_config
▼
engine
►
impl
▼
io
►
sys_linux
►
buffered.hpp
►
common.hpp
►
exception.hpp
fd_control_holder.hpp
►
fd_poller.hpp
►
pipe.hpp
►
sockaddr.hpp
►
socket.hpp
►
tls_wrapper.hpp
►
subprocess
►
task
►
async.hpp
condition_variable.hpp
►
condition_variable_status.hpp
►
deadline.hpp
►
exception.hpp
►
future.hpp
►
future_status.hpp
►
get_all.hpp
io.hpp
mutex.hpp
►
run_in_coro.hpp
►
run_standalone.hpp
►
semaphore.hpp
shared_mutex.hpp
►
single_consumer_event.hpp
single_use_event.hpp
single_waiting_task_mutex.hpp
►
sleep.hpp
task_processors_load_monitor.hpp
►
wait_all_checked.hpp
►
wait_any.hpp
►
error_injection
►
fs
►
logging
►
moodycamel
►
net
►
os_signals
►
rcu
►
server
►
storages
►
testsuite
►
tracing
►
utils
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
File Members
►
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
pipe.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/engine/io/pipe.hpp
4
/// @brief @copybrief engine::io::Pipe
5
6
#
include
<
userver
/
engine
/
deadline
.
hpp
>
7
#
include
<
userver
/
engine
/
io
/
common
.
hpp
>
8
#
include
<
userver
/
engine
/
io
/
exception
.
hpp
>
9
#
include
<
userver
/
engine
/
io
/
fd_control_holder
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
engine::
io
{
14
15
namespace
impl {
16
class
FdControl;
17
}
// namespace impl
18
19
/// Reading end of an unidirectional pipe
20
class
PipeReader
final
:
public
ReadableBase
{
21
public
:
22
/// Whether the reading end of the pipe is valid.
23
bool
IsValid
()
const
override
;
24
25
/// Suspends current task until the pipe has data available.
26
[[nodiscard]]
bool
WaitReadable
(Deadline)
override
;
27
28
/// Receives at least one bytes from the pipe.
29
[[nodiscard]]
size_t
ReadSome
(
void
*
buf
,
size_t
len
,
30
Deadline
deadline
)
override
;
31
32
/// Receives exactly len bytes from the pipe.
33
/// @note Can return less than len if pipe is closed by peer.
34
[[nodiscard]]
size_t
ReadAll
(
void
*
buf
,
size_t
len
,
35
Deadline
deadline
)
override
;
36
37
/// File descriptor corresponding to the read end of the pipe.
38
int
Fd
()
const
;
39
40
/// Releases reading end file descriptor and invalidates it.
41
[[nodiscard]]
int
Release
()
noexcept
;
42
43
/// Closes and invalidates the reading end of the pipe.
44
/// @warning You should not call Close with pending I/O. This may work okay
45
/// sometimes but it's loosely predictable.
46
void
Close
();
47
48
private
:
49
friend
class
Pipe;
50
51
PipeReader() =
default
;
52
explicit
PipeReader(
int
fd);
53
54
impl::FdControlHolder fd_control_;
55
};
56
57
/// Writing end of an unidirectional pipe
58
class
PipeWriter
final
:
public
WritableBase
{
59
public
:
60
/// Whether the writing end of the pipe is valid.
61
bool
IsValid
()
const
;
62
63
/// Suspends current task until the pipe can accept more data.
64
[[nodiscard]]
bool
WaitWriteable
(Deadline)
override
;
65
66
/// Sends exactly len bytes to the pipe.
67
/// @note Can return less than len if pipe is closed by peer.
68
[[nodiscard]]
size_t
WriteAll
(
const
void
*
buf
,
size_t
len
,
69
Deadline
deadline
)
override
;
70
71
/// File descriptor corresponding to the write end of the pipe.
72
int
Fd
()
const
;
73
74
/// Releases writing end file descriptor and invalidates it.
75
[[nodiscard]]
int
Release
()
noexcept
;
76
77
/// Closes and invalidates the writing end of the pipe.
78
/// @warning You should not call Close with pending I/O. This may work okay
79
/// sometimes but it's loosely predictable.
80
void
Close
();
81
82
private
:
83
friend
class
Pipe;
84
85
PipeWriter() =
default
;
86
explicit
PipeWriter(
int
fd);
87
88
impl::FdControlHolder fd_control_;
89
};
90
91
/// Unidirectional pipe representation
92
class
Pipe
final
{
93
public
:
94
/// Constructs a unidirectional pipe
95
Pipe
();
96
97
PipeReader reader;
98
PipeWriter writer;
99
};
100
101
}
// namespace engine::io
102
103
USERVER_NAMESPACE_END
Docs version:
v1.0
,
v2.0
,
trunk/develop
userver
engine
io
pipe.hpp
Generated on Wed May 15 2024 22:19:14 for userver by
Doxygen
1.10.0