A question concerning application architecture
marek at octogan.net
Tue May 8 16:16:46 CEST 2012
This is my first post on the mailing list so first of all, Hello to
I have a few concerns and would appreciate if somebody could confirm or
explain whether I am right or wrong.
I need to build an application with modules doing heavy work run
concurrently. Let's call them modules.
Such modules should probably work within threads in order not to block
the whole application.
Now, I was thinking about running a ev_loop per thread and triggering
threads from other threads via ev_async_send() call.
Let's imagine a module is waiting for some events, in a thread . It is
pooling it's own ev_loop and basically does nothing.
Another thread (channel) reads some data, stores it/whatever and when
it's ready it wakes up waiting module and passes some data.
Channel in order to trigger module-thread calls ev_async_send() on
threads ev_loop and thread's ev_async watcher.
I would like to ask you if such a architecture is acceptable, and
runing ev_run() from every thread and waiting to be notified by
not decrease performance dramatically (as it will still be a kind of
spinlock/busy waiting occurs) ?
Plus, I would like to run some modules periodically, hence running
ev_timer or ev_periodic in a thread's loop.
Thanks for clarification and any advices.
[marek at octogan.net]
More information about the libev