Libftpp
A modern C++ library
thread.hpp
Go to the documentation of this file.
1 #ifndef THREAD_HPP
2 #define THREAD_HPP
3 
4 #include <functional>
5 #include <stdexcept>
6 #include <string>
7 #include <thread>
8 
9 #include "../thread_safe_iostream/thread_safe_iostream.hpp"
10 
35 class Thread
36 {
37 private:
38  std::function<void()> _funct;
39  std::thread _t;
40  ThreadSafeIOStream _stream;
41 
42 public:
43  Thread(const std::string& name, std::function<void()> funcToExecute);
44  ~Thread();
45 
46  void start();
47  void stop();
48 };
49 
50 #endif
Thread-Safe I/O Stream.
Simple Thread Wrapper.
Definition: thread.hpp:36
void start()
Definition: thread.cpp:13
~Thread()
Definition: thread.cpp:3
Thread(const std::string &name, std::function< void()> funcToExecute)
Definition: thread.cpp:7
void stop()
Definition: thread.cpp:23