Use readdir_r on threaded systems