-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeatherSink.h
46 lines (37 loc) · 958 Bytes
/
WeatherSink.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef __WEATHER_SINK_H__
#define __WEATHER_SINK_H__
#include "Config.h"
#include "Debug.h"
#include <pthread.h>
#include <semaphore.h>
#include "WeatherData.h"
class WeatherSink
{
public:
WeatherSink( Config cfg, WeatherData *wd, const char *name );
virtual ~WeatherSink();
// This is a function back that is called when new data is available
// from WeatherData
virtual void newData( void ) = 0;
// This function WILL be on it's own thread. It should probably loop
// forever.
virtual void main( ) = 0;
private:
pthread_t mainThreadID;
Now workerTime;
protected:
void endMain();
void startMain();
protected:
Config cfg;
WeatherData *wd;
sem_t notifyWorker;
sem_t working;
const char *name;
bool threadRunning;
Debug dbg;
};
extern "C" {
void *startWeatherSinkMainThread( void *ptr );
}
#endif // __WEATHER_SINK_H__