LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

is strtok thread safe?

Hello all,

Would anyone know if the strtok() implementation for Labwindows/CVI thread safe?

ndo
0 Kudos
Message 1 of 6
(4,505 Views)
It's not thread-safe and can't be because it uses some static information.
You can't even use it to parse two different strings, even if the calls to strtok are sequential.

Regards,
Nicolas
0 Kudos
Message 2 of 6
(4,492 Views)
The static information (the string pointer user passes to the first call) is stored in thread-local storage by strtok - so calls to strtok in different threads do not touch the same data. In this sense, strtok is thread safe. But the user must also make sure that the string being tokenized by strtok in one thread is not being used by other threads.
Message 3 of 6
(4,476 Views)
Thanks all.  Mohan, I suspected as much, but could not find any infomation on strtok() and thread safety in the help files.  Can we get a confirmation from NI?

ndo
0 Kudos
Message 4 of 6
(4,455 Views)
I do work for NI and am familiar with the CVI strtok implementation.
0 Kudos
Message 5 of 6
(4,433 Views)
Mohan,

Thank you.
0 Kudos
Message 6 of 6
(4,427 Views)