Currently, the readdir() call releases the GIL. I believe this is not thread-safe, because readdir() does not need to be re-entrant; we should use readdir_r where available to get a thread-safe version. Comments? Regards, Martin