userver
C++ Async Framework
Loading...
Searching...
No Matches
current_task.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/engine/task/current_task.hpp
4
/// @brief Utility functions that query and operate on the current task
5
6
#
include
<
cstddef
>
7
#
include
<
cstdint
>
8
9
#
include
<
userver
/
engine
/
task
/
task_processor_fwd
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
engine::ev {
14
class
ThreadControl;
15
}
// namespace engine::ev
16
17
namespace
engine {
18
19
/// @brief Namespace with functions to work with current task from within it
20
namespace
current_task
{
21
22
/// Returns true only when running in userver coroutine environment,
23
/// i.e. in an engine::TaskProcessor thread.
24
bool
IsTaskProcessorThread
()
noexcept
;
25
26
/// Returns reference to the task processor executing the caller
27
TaskProcessor
&
GetTaskProcessor
();
28
29
/// Returns task coroutine stack size
30
std::size_t
GetStackSize
();
31
32
/// @cond
33
// Returns ev thread handle, internal use only
34
ev::ThreadControl& GetEventThread();
35
/// @endcond
36
37
}
// namespace current_task
38
39
namespace
impl
{
40
41
// For internal use only.
42
std::uint64_t GetCreatedTaskCount(TaskProcessor&);
43
44
}
// namespace impl
45
46
}
// namespace engine
47
48
USERVER_NAMESPACE_END
userver
engine
task
current_task.hpp
Generated on Tue Nov 19 2024 11:25:23 for userver by
Doxygen
1.10.0