5 years, 5 months ago.

API to get_name of current thread

What API should I use to get the name of the current thread? There is a get_id to get thread ID that I can use likeThisThread::get_id(). But ThisThread::get_name() does not work (compilation error).

1 Answer

5 years, 5 months ago.

Hi Santosh,

Update

I misunderstood your question, there is a PR for adding ThisThread::get_name() https://github.com/ARMmbed/mbed-os/pull/8961 and it would be released in Mbed OS 5.12.

Old answer

You probably are using old version mbed library, we recommend you to update mbed library to latest version, which is mbed-os-5.11.

If you are using offline mbed-cli, please use the following command

update mbed library

mbed update

If you are using online compiler, please follow below instructions

  • Right-click on mbed-os and select Revisions
  • Select the latest version (which should be the top one)
  • Click "Switch"

The top line will turn into bold text.

Please feel free to ask me any questions!

- Desmond, team Mbed