Make _beacon_listdir thread safe

The _beacon_listdir may block using os.stat or os.listdir on
remote filesystems or when hard disks are spinned down. Using
the function in a thread will prevent the mainloop from blocking.
The beacon server uses _beacon_mtime() which calls this function
in a blocking way (bit it is only the server).
Call _beacon_listdir in a thread