mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
move libthread to libstb-hal
Origin commit data
------------------
Branch: master
Commit: 95ee7f9e98
Author: smogm <smogm@vh0st.me>
Date: 2015-01-12 (Mon, 12 Jan 2015)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
23
include/condition_abstraction.h
Normal file
23
include/condition_abstraction.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _CONDITION_ABSTRACTION_H
|
||||
#define _CONDITION_ABSTRACTION_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "mutex_abstraction.h"
|
||||
|
||||
class Condition
|
||||
{
|
||||
pthread_cond_t mCondition;
|
||||
|
||||
Condition(const Condition&);
|
||||
const Condition& operator=(const Condition&);
|
||||
|
||||
public:
|
||||
Condition();
|
||||
virtual ~Condition();
|
||||
virtual int wait(Mutex* const aMutex);
|
||||
virtual int broadcast();
|
||||
virtual int signal();
|
||||
};
|
||||
|
||||
#endif
|
25
include/mutex_abstraction.h
Normal file
25
include/mutex_abstraction.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _MUTEX_ABSTRACTION_H
|
||||
#define _MUTEX_ABSTRACTION_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class Mutex
|
||||
{
|
||||
friend class Condition;
|
||||
|
||||
pthread_mutex_t mMutex;
|
||||
|
||||
Mutex(const Mutex&);
|
||||
const Mutex& operator=(const Mutex&);
|
||||
|
||||
protected:
|
||||
explicit Mutex(int);
|
||||
|
||||
public:
|
||||
Mutex();
|
||||
virtual ~Mutex();
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
};
|
||||
|
||||
#endif
|
16
include/reentrant_mutex.h
Normal file
16
include/reentrant_mutex.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef _REENTRANT_MUTEX_H
|
||||
#define _REENTRANT_MUTEX_H
|
||||
|
||||
#include "mutex_abstraction.h"
|
||||
|
||||
class ReentrantMutex : public Mutex
|
||||
{
|
||||
ReentrantMutex(const ReentrantMutex&);
|
||||
const ReentrantMutex& operator=(const ReentrantMutex&);
|
||||
|
||||
public:
|
||||
ReentrantMutex();
|
||||
virtual ~ReentrantMutex();
|
||||
};
|
||||
|
||||
#endif
|
18
include/scoped_lock.h
Normal file
18
include/scoped_lock.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _SCOPED_LOCK_H
|
||||
#define _SCOPED_LOCK_H
|
||||
|
||||
#include "mutex_abstraction.h"
|
||||
|
||||
class ScopedLock
|
||||
{
|
||||
Mutex& mMutex;
|
||||
|
||||
ScopedLock(const ScopedLock&);
|
||||
const ScopedLock& operator=(const ScopedLock&);
|
||||
|
||||
public:
|
||||
ScopedLock(Mutex&);
|
||||
~ScopedLock();
|
||||
};
|
||||
|
||||
#endif
|
30
include/thread_abstraction.h
Normal file
30
include/thread_abstraction.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef _THREAD_ABSTRACTION_H
|
||||
#define _THREAD_ABSTRACTION_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class Thread
|
||||
{
|
||||
bool mIsRunning;
|
||||
pthread_t mThread;
|
||||
|
||||
static void* runThread(void*);
|
||||
Thread(const Thread&);
|
||||
const Thread& operator=(const Thread&);
|
||||
|
||||
public:
|
||||
Thread();
|
||||
virtual ~Thread();
|
||||
int startThread();
|
||||
int cancelThread();
|
||||
int detachThread();
|
||||
int joinThread();
|
||||
|
||||
int setCancelModeDisable();
|
||||
int setSchedulePriority(int);
|
||||
|
||||
protected:
|
||||
virtual void run() = 0;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user