forked from carbonengine/db
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskletBlockingIO.h
More file actions
46 lines (36 loc) · 766 Bytes
/
Copy pathTaskletBlockingIO.h
File metadata and controls
46 lines (36 loc) · 766 Bytes
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
42
43
44
45
46
// Copyright © 2024 CCP ehf.
#ifndef DB_TASKLETBLOCKINGIO_H
#define DB_TASKLETBLOCKINGIO_H
#include "StdAfx.h"
struct PyChannelObject; // Forward declare the PyChannleObject from <Scheduler.h>
class IOWorker : public std::enable_shared_from_this<IOWorker>
{
public:
IOWorker();
~IOWorker();
bool ExecuteAndWait();
enum State
{
PENDING = 1,
FAILED = 2,
CANCELED = 3,
DONE = 4
};
State mState;
virtual void ThreadFunc() = 0;
void MarkCancelled();
void Complete();
private:
PyChannelObject* mChannel;
};
class IOWorkerContext
{
public:
IOWorkerContext();
bool Init();
void Schedule( std::shared_ptr<IOWorker> request );
private:
uv_loop_t* mLoop;
};
IOWorkerContext* GetTaskletBlockingRequestContext();
#endif //DB_TASKLETBLOCKINGIO_H