blob: ec86458cf05e56f49d6569f34fab413d1bbdfdef (
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
36
37
38
39
40
41
|
#pragma once
#include <library/cpp/coroutine/engine/impl.h>
#include <util/generic/yexception.h>
#include <util/stream/output.h>
namespace NNeh {
class IJob {
public:
inline void operator()(TCont* c) noexcept {
try {
DoRun(c);
} catch (...) {
Cdbg << "run " << CurrentExceptionMessage() << Endl;
}
}
virtual ~IJob() {
}
private:
virtual void DoRun(TCont* c) = 0;
};
class IJobQueue {
public:
template <class T>
inline void Schedule(T req) {
ScheduleImpl(req.Get());
Y_UNUSED(req.Release());
}
virtual void ScheduleImpl(IJob* job) = 0;
virtual ~IJobQueue() {
}
};
IJobQueue* JobQueue();
}
|