This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Are values of OS_TID deterministic?

Is there a rule governing generation of RTX task ids OS_TID? It would be interesting to know:

a. if they are incremented sequentially, and
b. if there is a max value for OS_TID

I am writing a lib which will cache some data in a buffer. That lib can be called from multiple tasks at the same time, so I want to keep separate buffers for each task. If OS_TID is deterministic then it will be a good differentiator for the per-task buffers.

Any other suggestions are welcome too.

Thanks

Parents
  • What Keil is doing, is quite similar to how thread local storage is implemented - which was the reason I did mention this concept earlier.

    And this is because thread local storage tries to solve the similar problem that Keil wants to solve when they make their CRTL thread-safe.

    The other common route to make library functions thread-safe is functions like gmtime_r(), gethostbyname_r() etc where a specific thread-safe variant of standard functions takes a pointer to a thread-local structure. Which obviously doesn't work for malloc() and all other standard C functions where you can't break the API.

Reply
  • What Keil is doing, is quite similar to how thread local storage is implemented - which was the reason I did mention this concept earlier.

    And this is because thread local storage tries to solve the similar problem that Keil wants to solve when they make their CRTL thread-safe.

    The other common route to make library functions thread-safe is functions like gmtime_r(), gethostbyname_r() etc where a specific thread-safe variant of standard functions takes a pointer to a thread-local structure. Which obviously doesn't work for malloc() and all other standard C functions where you can't break the API.

Children
No data