//
// actionsList.InvokeAll();
-#include <pthread.h>
-#include <list>
+#include <vector>
#include <functional>
+#include <mutex>
// Generalized actor type - a method of some class with one argument
template <class ACTIVE_CLASS, typename DATA_TYPE>
ACTION(ACTIVE_CLASS & ac,
typename ACTOR<ACTIVE_CLASS, DATA_TYPE>::TYPE a,
DATA_TYPE d)
- : activeClass(ac), actor(a), data(d) {};
- void Invoke();
+ : activeClass(ac), actor(a), data(d) {}
+ 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);
// A list of an actions
// All methods are thread-safe
-class ACTIONS_LIST : private std::list<BASE_ACTION *>
+class ACTIONS_LIST : private std::vector<BASE_ACTION *>
{
public:
// Just a typedef for parent class
- typedef std::list<BASE_ACTION *> parent;
+ typedef std::vector<BASE_ACTION *> parent;
// Initialize mutex
ACTIONS_LIST();
// Invoke all actions in the list
void InvokeAll();
private:
- mutable pthread_mutex_t mutex;
+ mutable std::mutex m_mutex;
};
#include "actions.inl.h"