I have a question about starvation.
It seems that the cooperative threading model in NOX system requires that
the cooperative thread should give up the system processing resource by
itself.
e.g. call of co_block()
If some thread does not give up system processing resource by itself, it
leads starvation to the other threads in the same co_group?
e.g. "while(1){}" in an event handler may stop the whole system, since there
is only one co_group now.
Deng
On Tue, Jan 13, 2009 at 2:47 PM, Ye Deng <[email protected]> wrote:
> Thanks.
> Thats a powerful feature, which may complicate the application developing.
>
> Deng
>
>
>
>
> On Tue, Jan 13, 2009 at 11:30 AM, Teemu Koponen <[email protected]>wrote:
>
>> On Jan 13, 2009, at 09:26 , Ye Deng wrote:
>>
>> What does the "dispatch(*event) blocked" mean in the comment here?
>>> In what situation the Event_dispatcher::dispatch() may block?
>>> Please see the mark [?] below:
>>>
>>> void
>>> Event_dispatcher::dispatch(const Event& e)
>>> {
>>> const Event_name& name = e.get_name();
>>> if (p->table.find(name) != p->table.end()) {
>>> BOOST_FOREACH (Signal::value_type& i, p->table[name]) {
>>> try {
>>>
>>> // [?] is it possible an event handler may block here?
>>> // e.g. co_block() is called at the application level. I
>>> guess not...
>>> if (i.second(e) == STOP) {
>>>
>>> break;
>>> }
>>> } catch (const std::exception& e) {
>>> lg.err("Event processing leaked an exception: %s",
>>> e.what());
>>> break;
>>> }
>>> }
>>> }
>>> }
>>>
>>
>> Indeed, it is possible for the application code to call co_block()
>> (directly or indirectly) while handling an event -- just as you ponder
>> above. The ability to block in event handling code is a rather useful
>> feature. However, this does not mean that the NOX event processing would be
>> stopped completely until the application code unblocks again. What happens
>> is that another thread in the NOX core becomes responsible for processing
>> events and continues with the next event.
>>
>> HTH,
>> Teemu
>>
>> --
>>
>>
>
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org