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
13namespace Aws
14{
15 namespace Crt
16 {
17 namespace Io
18 {
23 enum class TaskStatus
24 {
27 };
28
35 {
36 public:
40 explicit operator bool() const noexcept { return m_loop != nullptr; }
41
46 void Schedule(std::function<void(TaskStatus)> &&task, std::chrono::nanoseconds run_in) noexcept;
47
48 private:
49 explicit EventLoop(aws_event_loop *loop) noexcept;
50
51 aws_event_loop *m_loop;
52
53 friend class ClientBootstrap;
54 };
55
73 {
74 public:
80 EventLoopGroup(uint16_t threadCount = 0, Allocator *allocator = ApiAllocator()) noexcept;
87 EventLoopGroup(uint16_t cpuGroup, uint16_t threadCount, Allocator *allocator = ApiAllocator()) noexcept;
89 EventLoopGroup(const EventLoopGroup &) = delete;
90 EventLoopGroup(EventLoopGroup &&) noexcept;
91 EventLoopGroup &operator=(const EventLoopGroup &) = delete;
92 EventLoopGroup &operator=(EventLoopGroup &&) noexcept;
93
97 operator bool() const;
98
102 int LastError() const;
103
105 aws_event_loop_group *GetUnderlyingHandle() noexcept;
106
107 private:
108 aws_event_loop_group *m_eventLoopGroup;
109 int m_lastError;
110 };
111 } // namespace Io
112
113 } // namespace Crt
114} // namespace Aws
#define AWS_CRT_CPP_API
Definition Exports.h:36
Definition Bootstrap.h:35
Definition EventLoopGroup.h:73
EventLoopGroup(const EventLoopGroup &)=delete
Definition EventLoopGroup.h:35
TaskStatus
Definition EventLoopGroup.h:24
aws_allocator Allocator
Definition Allocator.h:14
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition Allocator.cpp:24
Definition Allocator.h:11