AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
threadimpl.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef AJA_THREAD_IMPL_H
9 #define AJA_THREAD_IMPL_H
10 
11 #include <pthread.h>
12 #include "ajabase/system/system.h"
13 #include "ajabase/common/common.h"
14 #include "ajabase/system/thread.h"
15 #include "ajabase/system/lock.h"
16 
17 
19 {
20 public:
21 
22  AJAThreadImpl(AJAThread* pThreadContext);
23  virtual ~AJAThreadImpl();
24 
25  AJAStatus Start();
26 
27  AJAStatus Stop(uint32_t timeout = 0xffffffff);
28 
29  AJAStatus Kill(uint32_t exitCode);
30 
31  bool Active();
32  bool IsCurrentThread();
33 
34  AJAStatus SetPriority(AJAThreadPriority threadPriority);
35  AJAStatus GetPriority(AJAThreadPriority* pThreadPriority);
36 
37  AJAStatus SetRealTime(AJAThreadRealTimePolicy policy, int priority);
38 
39  AJAStatus Attach(AJAThreadFunction* pThreadFunction, void* pUserContext);
40  AJAStatus SetThreadName(const char *name);
41 
42  static uint64_t GetThreadId();
43  static void* ThreadProcStatic(void* pThreadImplContext);
44 
45 public:
47  pthread_t mThread;
48  pid_t mTid;
50  AJAThreadFunction* mThreadFunc;
53 
55  pthread_mutex_t mStartMutex;
56  pthread_cond_t mStartCond;
57 
58  bool mTerminate;
59  bool mExiting;
60  pthread_mutex_t mExitMutex;
61  pthread_cond_t mExitCond;
62 };
63 
64 #endif // AJA_THREAD_IMPL_H
65 
AJAThreadImpl::IsCurrentThread
bool IsCurrentThread()
Definition: threadimpl.cpp:406
AJAThreadImpl::mPriority
AJAThreadPriority mPriority
Definition: threadimpl.h:49
AJAThreadImpl::mpUserContext
void * mpUserContext
Definition: threadimpl.h:51
AJAThreadImpl::GetThreadId
static uint64_t GetThreadId()
Definition: threadimpl.cpp:685
AJAThreadImpl::SetThreadName
AJAStatus SetThreadName(const char *name)
Definition: threadimpl.cpp:672
AJAThreadImpl::mThreadFunc
AJAThreadFunction * mThreadFunc
Definition: threadimpl.h:50
AJAThreadImpl::~AJAThreadImpl
virtual ~AJAThreadImpl()
Definition: threadimpl.cpp:84
AJAThreadImpl::mThread
pthread_t mThread
Definition: threadimpl.h:47
AJAThreadPriority
AJAThreadPriority
Definition: thread.h:39
AJAThreadImpl
Definition: threadimpl.h:18
AJAThread
Definition: thread.h:69
AJAThreadImpl::mLock
AJALock mLock
Definition: threadimpl.h:52
AJAStatus
AJAStatus
Definition: types.h:365
AJAThreadImpl::Kill
AJAStatus Kill(uint32_t exitCode)
Definition: threadimpl.cpp:332
AJAThreadImpl::mExitCond
pthread_cond_t mExitCond
Definition: threadimpl.h:61
lock.h
Declares the AJALock class.
AJAThreadImpl::mStartCond
pthread_cond_t mStartCond
Definition: threadimpl.h:56
AJAThreadImpl::mTid
pid_t mTid
Definition: threadimpl.h:48
AJAThreadImpl::Active
bool Active()
Definition: threadimpl.cpp:386
AJAThreadImpl::mStartMutex
pthread_mutex_t mStartMutex
Definition: threadimpl.h:55
AJALock
Definition: lock.h:30
system.h
System specific functions.
AJAThreadImpl::mTerminate
bool mTerminate
Definition: threadimpl.h:58
common.h
Private include file for all ajabase sources.
AJAThreadImpl::mThreadStarted
bool mThreadStarted
Definition: threadimpl.h:54
AJAThreadRealTimePolicy
AJAThreadRealTimePolicy
Definition: thread.h:50
AJAThreadImpl::mExitMutex
pthread_mutex_t mExitMutex
Definition: threadimpl.h:60
AJAThreadImpl::ThreadProcStatic
static void * ThreadProcStatic(void *pThreadImplContext)
Definition: threadimpl.cpp:581
AJAThreadImpl::AJAThreadImpl
AJAThreadImpl(AJAThread *pThreadContext)
Definition: threadimpl.cpp:45
AJAThreadImpl::Stop
AJAStatus Stop(uint32_t timeout=0xffffffff)
Definition: threadimpl.cpp:208
AJAThreadImpl::mpThreadContext
AJAThread * mpThreadContext
Definition: threadimpl.h:46
AJAThreadImpl::Start
AJAStatus Start()
Definition: threadimpl.cpp:116
AJAThreadImpl::SetPriority
AJAStatus SetPriority(AJAThreadPriority threadPriority)
Definition: threadimpl.cpp:425
AJAThreadImpl::Attach
AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: threadimpl.cpp:566
thread.h
Declares the AJAThread class.
AJAThreadImpl::GetPriority
AJAStatus GetPriority(AJAThreadPriority *pThreadPriority)
Definition: threadimpl.cpp:504
AJAThreadImpl::SetRealTime
AJAStatus SetRealTime(AJAThreadRealTimePolicy policy, int priority)
Definition: threadimpl.cpp:522
AJAThreadImpl::mExiting
bool mExiting
Definition: threadimpl.h:59