title: Locking directory and make other part of the code to wait until the directory is released by the thread
body: <p>How to lock the directory that is beign processed in a thread ? and The Wait to write a new set of file to the directory after the folder is released by the thread that started procesing the folder?</p>