reentrant version of system call (strtol)

In my code I convert a string to an integer with the strtol() function. I use this function in multiple threads at the same time.

I found this in the documentation:

C:\Cygwin\docs\MC-Libraries.pdf (page 43):
“The alternate function, _strtol_r, is a reentrant version. The extra argument, reent, is a pointer to a reentrancy structure.”

So I need the reentrant version. But what ‘reentrancy structure’ should I use? Perhaps a TX_MUTEX?

Note: I’m using NET+OS 7.1 with the Microcross (GNU) toolchain.

Why not just use atoi()?

“atoi(s) is implemented as (int)strtol(s, NULL, 10).”

Note: atoi() isn’t usefull for the ‘real’ programming, because it doesn’t do any error checking.