Is it safe to cast the osThreadId pointer to a 32-bit integer for a unique thread ID across platform
Hey friends, Porting a product to a CMSIS RTOS. We need a 32-bit integer representing the thread ID. While is opaque, comments suggest it's a pointer. Is it safe to cast the pointer to a 32-bit integer for a unique thread ID across platforms? Why or why not?
@Middleware & OS
@Middleware & OS
Solution
Hi @Dtynin , Casting a
this is how your code should look like for maintaining a map
osThreadId pointer to a 32-bit integer is generally not safe and should be avoided, instead you can try maintain a mapping or using a 64-bit Integer.this is how your code should look like for maintaining a map