EHS
Task.h
Go to the documentation of this file.
1#pragma once
2
3#include "EHS.h"
4#include "BaseObj.h"
5#include "ehs/system/Thread.h"
7
8namespace ehs
9{
10 typedef void (*TaskCb)(Serializer<UInt_64>*);
11
12 class EHS_LIB_IO Task
13 {
14 private:
15 bool working;
16 Semaphore* available;
17 Semaphore* done;
18 Serializer<UInt_64>** cbArgs;
19 TaskCb* callback;
20 Serializer<UInt_64>* threadArgs;
21 Thread thread;
22
23 public:
24 ~Task();
25
26 Task();
27
28 Task(Task&& task) noexcept;
29
30 Task(const Task& task);
31
32 Task& operator=(Task&& task) noexcept;
33
34 Task& operator=(const Task& task);
35
36 void Revalidate();
37
38 void Initialize();
39
40 void Release();
41
42 bool IsWorking() const;
43
44 void GiveWork(Serializer<UInt_64> args, TaskCb cb);
45
46 void WaitUntilDone();
47
48 bool IsValid() const;
49 };
50}
Definition: Semaphore_P.h:12
Definition: Task.h:13
Definition: Thread.h:24
Definition: Anchor.h:6
void(* TaskCb)(Serializer< UInt_64 > *)
Definition: Task.h:10
EHS_LIB_IO void Initialize(Str_8 appName, Str_8 appVerId, const Version &appVer)
Definition: EHS.cpp:34