in reply to Re^3: Question in Win32::ChangeNotify...
in thread Question in Win32::ChangeNotify...

  1. There is setTimer() which will send a message to the application message queue, but since Perl does not give you access to the dispatch loop, you cannot make use of this.
  2. There are also CreateWaitableTimer() which gives you a handle that can be passed along with the semaphore used by ChangeNotify, to the WaitForMultipleObjects() call that underlies the Win32::IPC wait() and wait_all() calls.

    This would cause the wait to return if either a file changed, or if the timer went off.

    But you would need to go through the hoops of using Win32::API to set up the waitable timer, and there is no guarentee that you could pass the resulting system object to the module and have it make use of it.

It is far simpler to just calculate the difference between the current time and the target wakeup time and use that as a timeout on your wait calls.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re^4: Question in Win32::ChangeNotify...