DelegateMQ
Loading...
Searching...
No Matches
freertos/Thread.h
Go to the documentation of this file.
1#ifndef _THREAD_FREERTOS_H
2#define _THREAD_FREERTOS_H
3
4#include "delegate/IThread.h"
5#include "FreeRTOS.h"
6#include "task.h"
7#include "queue.h"
8
9#include <thread>
10#include <queue>
11#include <mutex>
12#include <atomic>
13#include <condition_variable>
14#include <future>
15
16class ThreadMsg;
17
18class Thread : public dmq::IThread
19{
20public:
22 Thread(const std::string& threadName);
23
25 ~Thread();
26
29 bool CreateThread();
30
32 TaskHandle_t GetThreadId();
33
35 static TaskHandle_t GetCurrentThreadId();
36
38 std::string GetThreadName() { return THREAD_NAME; }
39
40 virtual void DispatchDelegate(std::shared_ptr<dmq::DelegateMsg> msg);
41
42private:
43 Thread(const Thread&) = delete;
44 Thread& operator=(const Thread&) = delete;
45
47 static void Process(void*);
48
49 TaskHandle_t m_thread = nullptr;
50 QueueHandle_t m_queue = nullptr;
51
52 const std::string THREAD_NAME;
53};
54
55#endif
56
A base class for a delegate enabled execution thread. Implemented by application code if asynchronous...
Definition freertos/Thread.h:19
std::string GetThreadName()
Get thread name.
Definition freertos/Thread.h:38
Thread(const std::string &threadName)
Constructor.
Definition freertos/Thread.cpp:14
virtual void DispatchDelegate(std::shared_ptr< dmq::DelegateMsg > msg)
TaskHandle_t GetThreadId()
Get the ID of this thread instance.
Definition freertos/Thread.cpp:51
~Thread()
Destructor.
Definition freertos/Thread.cpp:21
bool CreateThread()
Definition freertos/Thread.cpp:28
static TaskHandle_t GetCurrentThreadId()
Get the ID of the currently executing thread.
Definition freertos/Thread.cpp:62
A class to hold a platform-specific thread messsage that will be passed through the OS message queue.
Definition freertos/ThreadMsg.h:7
Definition IThread.h:17