Skip to content

Commit a5af4ec

Browse files
committed
- Added custom thread naming as an option
1 parent 28e8a6f commit a5af4ec

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ESPressio_IThread.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ namespace ESPressio {
3131
typedef std::function<void(IThread*)> ThreadCallback;
3232
typedef std::function<void(IThread*, ThreadState, ThreadState)> ThreadStateChangeCallback;
3333

34+
virtual String GetThreadNamePrefix() const = 0;
35+
3436
// Destructor
3537

3638
virtual ~IThread() {}

src/ESPressio_Thread.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ namespace ESPressio {
126126
// Methods
127127
void GarbageCollect();
128128

129+
virtual String GetThreadNamePrefix() const { return "thread"; }
130+
129131
void Initialize() override {
130132
if (_taskHandle != NULL) { vTaskResume(_taskHandle); } // Resume existing Task if it exists...
131133
else { // ... or Create a new Task if it doesn't!
132-
String threadIDStr = "thread" + String(GetThreadID());
134+
String threadIDStr = GetThreadNamePrefix() + String(GetThreadID());
133135
xTaskCreatePinnedToCore(
134136
[](void* parameter) {
135137
Thread* instance = static_cast<Thread*>(parameter);

0 commit comments

Comments
 (0)