scandir() and threads

I couldn't find anywhere informations about it. Is scandir() thread-safe?

scandir() is supposed to be threadsafe on POSIX-compliant systems
Here is a list of those that are not threadsafe from unix.org:

Thread-safety


The following functions are not guaranteed to be thread-safe on all UNIX systems: 

asctime()  basename()  catgets()  ctime()  
dbm_clearerr()  dbm_close()  dbm_delete()  dbm_error()  
dbm_fetch()  dbm_firstkey()  dbm_nextkey()  dbm_open()  
dbm_store()  dirname()  drand48()  ecvt()  
encrypt()  endgrent()  endpwent()  endutxent()  
fcvt()  gamma()  gcvt()  getc_unlocked()  
getchar_unlocked()  getdate()  getenv()  getgrent()  
getgrgid()  getgrnam()  getlogin()  getopt()  
getpwnam()  getpwent()  getpwuid()  getutxent()  
getutxid()  getutxline()  getw()  gmtime()  
l64a()  lgamma()  lrand48()  localtime()  
mrand48()  nl_langinfo()  ptsname()  putc_unlocked()  
putchar_unlocked()  putenv()  pututxline()  rand()  
readdir()  setgrent()  setkey()  setpwent()  
setutxent()  strerror()  strtok()  ttyname()  



The functions ctermid() and tmpnam() need not be thread-safe if passed a NULL argument. 


I saw this list, but I was confused, when I read sources of scandir() (from glibc):

[...]
#define READDIR __readdir
[...]
  while ((d = READDIR (dp)) != NULL)
[...]

readdir() isn't thread safe

Are you on linux? __readdir is a symbol, an entry point for the syscall. You need to read the __readdir kernel code.

scandir() is re-entrant and threadsafe because it does not use local static data like strtok() or localtime(). scandir is not async-safe.

Yes, I use linux.
Thanks for help