aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Loading...
Searching...
No Matches
EventLoopGroup.h
Go to the documentation of this file.
1#pragma once
6#include <aws/crt/Types.h>
7
8#include <aws/io/event_loop.h>
9
10#include <chrono>
11#include <functional>
12#include <memory>
13
14namespace Aws
15{
16 namespace Crt
17 {
18 namespace Io
19 {
24 enum class TaskStatus
25 {
28 };
29
35 {
36 public:
37 ScheduledTask() noexcept = default;
38
39 void Cancel() noexcept;
40
41 private:
42 class Impl;
43
44 explicit ScheduledTask(std::shared_ptr<Impl> impl) noexcept;
45
46 std::shared_ptr<Impl> m_impl;
47
48 friend class EventLoop;
49 };
50
57 {
58 public:
62 explicit operator bool() const noexcept { return m_loop != nullptr; }
63
69 ScheduledTask Schedule(
70 std::function<void(TaskStatus)> &&task,
71 std::chrono::nanoseconds run_in) noexcept;
72
73 private:
74 explicit EventLoop(aws_event_loop *loop) noexcept;
75
76 aws_event_loop *m_loop;
77
78 friend class ClientBootstrap;
79 };
80
98 {
99 public:
105 EventLoopGroup(uint16_t threadCount = 0, Allocator *allocator = ApiAllocator()) noexcept;
112 EventLoopGroup(uint16_t cpuGroup, uint16_t threadCount, Allocator *allocator = ApiAllocator()) noexcept;
115 EventLoopGroup(EventLoopGroup &&) noexcept;
116 EventLoopGroup &operator=(const EventLoopGroup &) = delete;
117 EventLoopGroup &operator=(EventLoopGroup &&) noexcept;
118
122 operator bool() const;
123
127 int LastError() const;
128
130 aws_event_loop_group *GetUnderlyingHandle() noexcept;
131
132 private:
133 aws_event_loop_group *m_eventLoopGroup;
134 int m_lastError;
135 };
136 } // namespace Io
137
138 } // namespace Crt
139} // namespace Aws
#define AWS_CRT_CPP_API
Definition Exports.h:36
Definition Bootstrap.h:35
Definition EventLoopGroup.h:98
EventLoopGroup(const EventLoopGroup &)=delete
Definition EventLoopGroup.h:57
Definition EventLoopGroup.cpp:82
Definition EventLoopGroup.h:35
ScheduledTask() noexcept=default
TaskStatus
Definition EventLoopGroup.h:25
aws_allocator Allocator
Definition Allocator.h:14
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition Allocator.cpp:24
Definition Allocator.h:11
Definition StringView.h:862