Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: How to wait for events, and not lose any, while processing them ?

by Eyck (Priest)
on Jan 26, 2009 at 10:59 UTC ( #738907=note: print w/replies, xml ) Need Help??


in reply to Re: How to wait for events, and not lose any, while processing them ?
in thread How to wait for events, and not lose any, while processing them ?

The code above starts with use Linux::Inotify2, the problem is with processing the events, I don't quite get it how putting up another threads solves the issue, you still need to pause to push the data to another thread.
  • Comment on Re^2: How to wait for events, and not lose any, while processing them ?
  • Download Code

Replies are listed 'Best First'.
Re^3: How to wait for events, and not lose any, while processing them ?
by roboticus (Chancellor) on Jan 26, 2009 at 15:54 UTC
    Eyck:

    Frequently, event handlers are done in a callback style with very little in the way of resources. (For example, in interrupt handlers, the interrupts may be disabled during the handler body, preventing other interrupt-driven events from being noticed.) So typically, you store the request with as little processing as possible, to allow the event system to get back to its job of collecting events.

    Then your other thread can pull events off the queue and process them. That way, if you have a rapid flurry of events, they'll stack up in the queue. If you tried handling them in the event handler, the rapid flurry of events could be lost.

    Please note that this is a "hand wavy" explanation because there are many similar systems in which the implementation details are different, and I don't know anything about the Linux::Inotify2 package, so I can't comment on any specifics.

    ...roboticus

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://738907]
help
Chatterbox?
[erix]: in this context, one learns all kinds of interesting psychological excuse-jargon: not just 'alternative facts'; how about 'gapped knowledge' ? :)
[erix]: which still manages to sound more or less positive
[Corion]: Huh. I wasn't aware that you cannot segregate Python 2 and Python 3 modules... Hopefully Perl 6 module use C6AN and thus avoid the problem...
[hippo]: I very much hope so.
[moritz]: there are already some (very few) Perl 6 modules on CPAN, but in a way that the p5 indexer avoids them
[hippo]: It's confusing enough to have the Perl6:: namespace which isn't for Perl6 but for features from that ported into Perl.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2017-01-24 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.