Use reentrant thread save readdir_r, more documentation about directories