AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
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 
18 class AJAThreadImpl
19 {
20 public:
21 
22  AJAThreadImpl(AJAThread* pThreadContext);
23  virtual ~AJAThreadImpl();
24 
25  AJAStatus Start();
26  AJAStatus Stop(uint32_t timeout = 0xffffffff);
27 
28  AJAStatus Kill(uint32_t exitCode);
29 
30  bool Active();
31  bool IsCurrentThread();
32 
33  AJAStatus SetPriority(AJAThreadPriority threadPriority);
34  AJAStatus GetPriority(AJAThreadPriority* pThreadPriority);
35 
36  AJAStatus SetRealTime(AJAThreadRealTimePolicy policy, int priority);
37 
38  AJAStatus Attach(AJAThreadFunction* pThreadFunction, void* pUserContext);
39 
40  static uint64_t GetThreadId();
41  static void* ThreadProcStatic(void* pThreadImplContext);
42  AJAStatus SetThreadName(const char *name);
43 
45  pthread_t mThread;
47  AJAThreadFunction* mThreadFunc;
48  void* mpUserContext;
49  AJALock mLock;
50  bool mTerminate;
51  bool mExiting;
52  pthread_mutex_t mExitMutex;
53  pthread_cond_t mExitCond;
54 };
55 
56 #endif // AJA_THREAD_IMPL_H
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:378
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::Active
bool Active()
Definition: threadimpl.cpp:386
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.
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