blob: ab9b7c85eaf2c919a5f0145d97276e9f6ddc1562 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "poller_tcp.h"
namespace NInterconnect {
TPollerThreads::TPollerThreads(size_t units, bool useSelect)
: Units(units)
{
Y_DEBUG_ABORT_UNLESS(!Units.empty());
for (auto& unit : Units)
unit = TPollerUnit::Make(useSelect);
}
TPollerThreads::~TPollerThreads() {
}
void TPollerThreads::Start() {
for (const auto& unit : Units)
unit->Start();
}
void TPollerThreads::Stop() {
for (const auto& unit : Units)
unit->Stop();
}
void TPollerThreads::StartRead(const TIntrusivePtr<TSharedDescriptor>& s, TFDDelegate&& operation) {
auto& unit = Units[THash<SOCKET>()(s->GetDescriptor()) % Units.size()];
unit->StartReadOperation(s, std::move(operation));
}
void TPollerThreads::StartWrite(const TIntrusivePtr<TSharedDescriptor>& s, TFDDelegate&& operation) {
auto& unit = Units[THash<SOCKET>()(s->GetDescriptor()) % Units.size()];
unit->StartWriteOperation(s, std::move(operation));
}
}
|