While writing directory iterator, I discovered that readdir
function is not re-entrant. readdir_r
function seems re-entrant version of that, but I don't know how to confirm this. Though readdir
is explicitly marked non-reentrant, but there's no mention for readdir_r
.
Is there a way to check re-entrancy of specific POSIX function? How to check re-entrancy of a POSIX function?
Here is a POSIX.1c policy for re-entrancy.
Here's my summary.
Here's another caveat claim.
Cited from the text.
Anyway, there's another claim of these steps are not required anymore: Is it required for me to add a _REENTRANT macro during compile time to make my errno thread safe? It seems we don't need to define
_REENTRANT
anymore.The term reentrancy is a legacy term from single threaded environment. Anyway, POSIX.1c presumes multi-threaded environment, and it silently assumes re-entering from other thread cases.