Re: Event.pm and synchronized timers?

[email protected] (Joshua Pritikin)
Newsgroups perl.loop
Message-ID <[email protected]>
>Thanks for the Event Perl module! It looks like it may make my job easier. I 
>did have a question that I couldn't answer after reading the documentation, 
>though:
>
>I would like to use Event for controlling a data collection program. I would 
>like the data for multiple channels to be collected as near to simultaneously 
>(to the second or so) as possible.
>
>I may use separate processes doing the collection, and I will probably have 
>multiple channels collected with a single process.
>
>Let's say that every channel is to be collected every minute. I'd like to set 
>everything up so that the sampling happens at the same time both within a 
>process and across multiple processes. Sampling won't take too long in the 
>usual case (typically less than a second for serial port devices, less than 
>100 msec for other devices).
>
>How can I force events to occur at a specific time (and, say, every minute 
>after that time)? Would it be sufficient to wait to start the loop until just 
>the right point in time? I saw the 'hard' watcher option; I'm assuming that I 
>want to set that.
>
>Can I tweak a periodic event to occur next at the right time somehow?
>
>I figured that I could synchronize multiple processes by passing them the 
>base start time and interval; they could wait until the next time that:
>	(time() - baseTime) % interval == 0
>and then start their loops or otherwise synchronize.

Did you try $timer->hard(1) ?


_____________________________________________________________
Thank you for choosing LinuxQuestions.
http://www.linuxquestions.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.