Background tasks with libev

Kevyn-Alexandre Paré kapare at rogue-research.com
Wed Apr 3 19:19:31 CEST 2013


Hi,

As my past habits was to always create a thread when something requires more processing time. I'm a bit confused to when to use thread with libev and how to manage longer tasks. My first thought is that I have started to use libev to remove the overhead of thread,  context switching and mutex. 

I'm trying to come up with some personal rules and I still have some questions that are not answered:

1- How long could I stay in a callback (ex: io watcher callback) and process data until the rest of my system become non responsive (ex: server)?
2- Will it be preferable to simply start a thread if we know that the processing could go higher to a certain threshold? 
3- How to determine that acceptable threshold?

Do you have some thought on that subject?

Best Regards,

-KA




More information about the libev mailing list