EHS
Loading...
Searching...
No Matches
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 Serializer.h:25
bool IsWorking() const
Definition Task.cpp:183
void Release()
Definition Task.cpp:153
bool IsValid() const
Definition Task.cpp:212
void Initialize()
Definition Task.cpp:132
void GiveWork(Serializer< UInt_64 > args, TaskCb cb)
Definition Task.cpp:188
Task & operator=(Task &&task) noexcept
Definition Task.cpp:85
void WaitUntilDone()
Definition Task.cpp:203
void Revalidate()
Definition Task.cpp:123
Task()
Definition Task.cpp:61
Definition Thread.h:24
Definition Anchor.h:6
void(* TaskCb)(Serializer< UInt_64 > *)
Definition Task.h:10