From bdb92dbb745bbd67e407fc0c1c5635108f8c5313 Mon Sep 17 00:00:00 2001 From: max_10 Date: Thu, 20 Sep 2018 17:45:51 +0200 Subject: [PATCH] Revert "add mutex and thread abstraction" This reverts commit e36707596a774f4bb8511a78e3e2abf13c2cd823. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/20ea3c14b79249d6c4959e3a28ff4cbcdf78448a Author: max_10 Date: 2018-09-20 (Thu, 20 Sep 2018) ------------------ This commit was generated by Migit --- generic-pc/mutex_abstraction.cpp | 22 --------------------- generic-pc/mutex_abstraction.h | 20 ------------------- generic-pc/thread_abstraction.cpp | 33 ------------------------------- generic-pc/thread_abstraction.h | 25 ----------------------- 4 files changed, 100 deletions(-) delete mode 100644 generic-pc/mutex_abstraction.cpp delete mode 100644 generic-pc/mutex_abstraction.h delete mode 100644 generic-pc/thread_abstraction.cpp delete mode 100644 generic-pc/thread_abstraction.h diff --git a/generic-pc/mutex_abstraction.cpp b/generic-pc/mutex_abstraction.cpp deleted file mode 100644 index a5a886f..0000000 --- a/generic-pc/mutex_abstraction.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "mutex_abstraction.h" - -Mutex::Mutex() : - mMutex() -{ - pthread_mutex_init(&mMutex, 0); -} - -Mutex::~Mutex() -{ - pthread_mutex_destroy(&mMutex); -} - -void Mutex::lock() -{ - pthread_mutex_lock(&mMutex); -} - -void Mutex::unlock() -{ - pthread_mutex_unlock(&mMutex); -} diff --git a/generic-pc/mutex_abstraction.h b/generic-pc/mutex_abstraction.h deleted file mode 100644 index c2b78d8..0000000 --- a/generic-pc/mutex_abstraction.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _MUTEX_ABSTRACTION_H -#define _MUTEX_ABSTRACTION_H - -#include - -class Mutex -{ - pthread_mutex_t mMutex; - - Mutex(const Mutex&); - const Mutex& operator=(const Mutex&); - - public: - Mutex(); - virtual ~Mutex(); - void lock(); - void unlock(); -}; - -#endif diff --git a/generic-pc/thread_abstraction.cpp b/generic-pc/thread_abstraction.cpp deleted file mode 100644 index 57b7759..0000000 --- a/generic-pc/thread_abstraction.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "thread_abstraction.h" - -Thread::Thread() : - mIsRunning(false), - mThread() -{ -} - -Thread::~Thread() -{ - // if thread is still running on object destruction, cancel thread the hard way: - if (mIsRunning) - { - pthread_cancel(mThread); - } -} - -void Thread::startThread() -{ - mIsRunning = true; - pthread_create(&mThread, 0, &Thread::runThread, this); -} - -void Thread::joinThread() -{ - pthread_join(mThread, 0); - mIsRunning = false; -} - -void* Thread::runThread(void* ptr) -{ - ((Thread*)ptr)->run(); -} diff --git a/generic-pc/thread_abstraction.h b/generic-pc/thread_abstraction.h deleted file mode 100644 index 3c3e35f..0000000 --- a/generic-pc/thread_abstraction.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _THREAD_ABSTRACTION_H -#define _THREAD_ABSTRACTION_H - -#include - -class Thread -{ - bool mIsRunning; - pthread_t mThread; - - static void* runThread(void*); - Thread(const Thread&); - const Thread& operator=(const Thread&); - - public: - Thread(); - ~Thread(); - void startThread(); - void joinThread(); - - protected: - virtual void run() = 0; -}; - -#endif