AllianceDB  0.0.1
AllianceDB is an open-source suite, including benchmarks and libs for evaluating and improving stream operation algorithms on modern hardwares.
AbstractC20Thread.h
Go to the documentation of this file.
1 
2 //
3 // Created by tony on 07/03/22.
4 //
5 
6 #ifndef _INCLUDE_UTILS_ABSTRACTC20THREAD_H_
7 #define _INCLUDE_UTILS_ABSTRACTC20THREAD_H_
8 #pragma once
9 #include <thread>
10 #include <memory>
21 namespace INTELLI {
29  protected:
34  virtual void inlineMain() {
35 
36  }
37 
38  std::shared_ptr<std::thread> threadPtr;
39  public:
41  ~AbstractC20Thread() {}
45  void startThread() {
46  auto fun = [this]() {
47  inlineMain();
48  };
49  threadPtr = std::make_shared<std::thread>(fun);
50  // table=make_shared<MultiThreadHashTable>(5000);
51  }
55  void joinThread() {
56  threadPtr->join();
57  }
58 
59 };
60 
61 }
62 
63 
64 
71 #endif //ALIANCEDB_INCLUDE_UTILS_ABSTRACTTHREAD_H_
The base class and abstraction of C++20 thread, and it can be derived into other threads.
Definition: AbstractC20Thread.h:28
virtual void inlineMain()
The inline 'main" function of thread, as an interface.
Definition: AbstractC20Thread.h:34
void startThread()
to start this thread
Definition: AbstractC20Thread.h:45
void joinThread()
the thread join function
Definition: AbstractC20Thread.h:55
Definition: DatasetTool.h:10