I want to use the pecl extension to php and use the inotify_read() function to detect changes in a file.
As a fail safe, I would like to specify a timeout value to the inotify_read function, just so I don't wind up blocking forever, in case an event is raised and is missed.
Does anyone know how to use the stream_select function to block for a specified number of seconds, but return immediately if an event is raised on the inotify_read.
I know there is way to perform the inotify_read non-blocking, but I don't want to sit there and poll, and I don't want the lag between when the file change happens vs. when I'll be informed by it.
I was able to use pcntl_alarm to interrupt the the system call, but I was hoping for something less intense.