Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Try it this way (untested):
All the threading overhead is up-front, leaving the only processing in the 'event loop', pushing the returned values onto shared memory, which is barely slower than assigning them to your array. If you find that the events are arriving faster than the thread can process them--and if you have multiple cores--start a second, third, fourth thread. If this were Win32, I'd boost the priority of the main thread to real-time to ensure that it was favoured by the schedular in the event that both it and one of the processing threads became eligable to run at the same time. But I don't know how to do that on *nix. 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.
In reply to Re: How to wait for events, and not lose any, while processing them ?
by BrowserUk
|
|