4

How can I stop the execution of a thread until a file is created ?
I would like to avoid doing it in a busy loop, and use something with a behavior similar to select(). Is something like this possible?
I only found ways to check if a file exists at a given time.

Nicolas Jean
  • 775
  • 6
  • 19

1 Answers1

3

You are probably looking for inotify(7). At the botton of the man page linked, there's example showing how to monitor for various events.

P.P
  • 117,907
  • 20
  • 175
  • 238
  • There are [APIs with similar features (but completely different names and functions) for Windows and OSX](http://stackoverflow.com/a/3517567/364696). – ShadowRanger Sep 07 '16 at 10:09
  • @usr: thank you, I think this is what I was looking for. More precisely, watching the directory that will contain the file for the IN_CREATE event and then checking if the file is there should work fine! – Nicolas Jean Sep 07 '16 at 12:01