Open System Services Programmer's Guide
Example Program Using Reentrant Functions
Example 74 (page 368) provides an example program that uses the strtok_r() reentrant fuction.
The program results in this ouput:
thread - 0 token - a
thread - 1 token - a
thread - 0 token - b
thread - 1 token - b
thread - 0 token - c
thread - 1 token - c
thread - 0 token - x
thread - 1 token - x
thread - 0 token - y
thread - 1 token - y
thread - 0 token - z
thread - 1 token - z
For comparison, the same program, using strtok(), instead of the reentrant version,
strtok_r(), results in this output:
thread - 0 token - a
thread - 1 token - a
thread - 0 token - b
thread - 1 token - c
thread - 0 token - x
thread - 1 token - y
thread - 0 token - z
thread - 1 token - x
thread - 0 token - y
thread - 1 token - z
Reentrant OSS Functions 367