libfilezilla
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
thread.hpp
Go to the documentation of this file.
1 #ifndef LIBFILEZILLA_THREAD_HEADER
2 #define LIBFILEZILLA_THREAD_HEADER
3 
4 #include "libfilezilla.hpp"
5 
6 #if !defined(FZ_WINDOWS) || !(defined(__MINGW32__) || defined(__MINGW64__))
7 #include <thread>
8 #endif
9 
14 namespace fz {
15 
29 class FZ_PUBLIC_SYMBOL thread
30 {
31 public:
32 #if defined(FZ_WINDOWS) && (defined(__MINGW32__) || defined(__MINGW64__))
33  typedef uint32_t id;
34 #else
35  typedef std::thread::id id;
36 #endif
37 
38  thread() = default;
39 
45  virtual ~thread();
46 
51  bool run();
52 
63  void join();
64 
69  bool joinable() const;
70 
72  static id own_id();
73 
74 protected:
76  virtual void entry() = 0;
77 
78 private:
79  class impl;
80  friend class impl;
81  impl* impl_{};
82 };
83 }
84 
85 #endif
Spawns and represents a new thread of execution.
Definition: thread.hpp:29
Sets some global macros and further includes string.hpp.