49 lines
917 B
C++
49 lines
917 B
C++
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
/*
|
|
* File: SPIT_Handler.h
|
|
* Author: Hagi
|
|
*
|
|
* Created on 24. April 2019, 11:17
|
|
*/
|
|
|
|
#ifndef SPIT_HANDLER_H
|
|
#define SPIT_HANDLER_H
|
|
|
|
#include "Mutex.hpp"
|
|
#include "Semaphore.hpp"
|
|
#include "Task.hpp"
|
|
#include <list>
|
|
|
|
using namespace std;
|
|
|
|
class SPIT_Handler {
|
|
public:
|
|
class Runnable {
|
|
public:
|
|
Runnable() {};
|
|
virtual ~Runnable();
|
|
virtual void run() = 0;
|
|
};
|
|
|
|
private:
|
|
static list<Runnable*> s_Runnables;
|
|
static fos::Mutex s_MutexLock;
|
|
static fos::Semaphore s_ConditionVariable;
|
|
static fos::Task* s_HandlerThread;
|
|
|
|
static bool s_WakeUp;
|
|
static bool s_Close;
|
|
static void run();
|
|
public:
|
|
static void addRunnable(Runnable* p_Runnable);
|
|
static void closeHandler();
|
|
};
|
|
|
|
#endif /* SPIT_HANDLER_H */
|
|
|