Merge pull request #13030 from kjbracey-arm/thisthreadgetname

Fix ThisThread::get_name definition
pull/13077/head
Martin Kojtal 2020-06-05 10:39:34 +02:00 committed by GitHub
commit 8ff3c95b2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -500,9 +500,8 @@ void test_thread_name()
const char tname[] = "Amazing thread"; const char tname[] = "Amazing thread";
Thread t(osPriorityNormal, THREAD_STACK_SIZE, NULL, tname); Thread t(osPriorityNormal, THREAD_STACK_SIZE, NULL, tname);
t.start(callback(thread_wait_flags));
TEST_ASSERT_EQUAL(strcmp(tname, t.get_name()), 0); TEST_ASSERT_EQUAL(strcmp(tname, t.get_name()), 0);
t.flags_set(0x1); t.start([&] { TEST_ASSERT_EQUAL(strcmp(tname, ThisThread::get_name()), 0); });
t.join(); t.join();
} }

View File

@ -272,7 +272,7 @@ osThreadId_t ThisThread::get_id()
#endif #endif
} }
const char *get_name() const char *ThisThread::get_name()
{ {
#if MBED_CONF_RTOS_PRESENT #if MBED_CONF_RTOS_PRESENT
osThreadId_t id = osThreadGetId(); osThreadId_t id = osThreadGetId();