]> git.stg.codes - stg.git/blobdiff - projects/stargazer/actions.h
Use std::jthread and C++17.
[stg.git] / projects / stargazer / actions.h
index eea72b77aa7357b456b955c35f1b3d33aa18a62f..33c9a8fdb4b57e282ddb832f4d075cbddf727e1c 100644 (file)
@@ -13,9 +13,9 @@
 //
 // actionsList.InvokeAll();
 
-#include <pthread.h>
 #include <vector>
 #include <functional>
+#include <mutex>
 
 // Generalized actor type - a method of some class with one argument
 template <class ACTIVE_CLASS, typename DATA_TYPE>
@@ -42,7 +42,7 @@ public:
            typename ACTOR<ACTIVE_CLASS, DATA_TYPE>::TYPE a,
            DATA_TYPE d)
         : activeClass(ac), actor(a), data(d) {}
-    void Invoke();
+    void Invoke() override;
 private:
     ACTION(const ACTION<ACTIVE_CLASS, DATA_TYPE> & rvalue);
     ACTION<ACTIVE_CLASS, DATA_TYPE> & operator=(const ACTION<ACTIVE_CLASS, DATA_TYPE> & rvalue);
@@ -82,7 +82,7 @@ public:
     // Invoke all actions in the list
     void InvokeAll();
 private:
-    mutable pthread_mutex_t mutex;
+    mutable std::mutex m_mutex;
 };
 
 #include "actions.inl.h"