Tag Info

New answers tagged

4

strtok is not thread-safe because it saves its state in static memory between calls. If two threads make concurrent or interleaved calls to strtok, they will get erroneous results. The strtok_r variant returns a pointer to the caller to use for future invocations on the same string. There are many other C and POSIX functions that are not safe to use from ...


0

If you want to ensure that your variables are consistent it is advisable to provide thread synchronization mechanisms to prevent crashes and race conditions I think you just hit what they were after. In any language you will have parts of it that are not thread safe and need synchronization mechanisms to prevent issues (look at the .net List for a ...



Top 50 recent answers are included