rpi-rgb-led-matrix/thread.h
Henner Zeller 8ef558fb9a o Make it possible to specify the display type (16x32 or 32x32) at
runtime.
o Specify number of chained boards at runtime.
o Smallish changes in demos.
2014-09-05 03:07:41 +00:00

27 lines
616 B
C++

// -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
#ifndef RPI_THREAD_H
#define RPI_THREAD_H
#include <pthread.h>
// Simple thread abstraction.
class Thread {
public:
Thread();
// The destructor waits for Run() to return so make sure it does.
virtual ~Thread();
// Start thread. If realtime_priority is > 0, then this will be a
// thread with SCHED_FIFO and the given priority.
void Start(int realtime_priority = 0);
// Override this.
virtual void Run() = 0;
private:
static void *PthreadCallRun(void *tobject);
bool started_;
pthread_t thread_;
};
#endif // RPI_THREAD_H