Hello all, I make a reply to this old mail again because I want to do something that: Block the current cooperative thread in an Event_handler to wait another Event to happen (resume the blocked thread) later. Thus, I am looking for some sample code doing this job. Does any existing app does this before?
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. >> 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
