public void poll() { foreach (Ichannel ch in event_set) { while (true) { ArrayList _event = ch.pop(); if (_event == null) { break; } String module_name = (String)_event[0]; if (module_set.ContainsKey(module_name)) { Imodule _module = (Imodule)module_set[module_name]; _module.process_event(ch, _event); } else { Console.WriteLine("do not have a module named:" + module_name); } } } }
public void unreg_module(Imodule module) { module_set.Remove(module.module_name); }
public void reg_module(Imodule module) { module_set.Add(module.module_name, module); }
public void poll() { lock (add_event) { foreach (var ch in add_event) { event_set.Add(ch); } add_event.Clear(); } lock (remove_event) { foreach (var ch in remove_event) { event_set.Remove(ch); } remove_event.Clear(); } foreach (Ichannel ch in event_set) { while (true) { ArrayList _event = null; try { _event = ch.pop(); } catch (Exception e) { throw new juggle.Exception(string.Format("channel pop, System.Exception:{0}", e)); } try { if (_event == null) { break; } if (_event.Count < 2) { throw new juggle.Exception(string.Format("error msg, {0}", _event[0])); } String module_name = (String)_event[0]; if (module_set.ContainsKey(module_name)) { Imodule _module = (Imodule)module_set[module_name]; _module.process_event(ch, _event); } else { throw new juggle.Exception(string.Format("do not have a module name:{0}, function name:{1}", module_name, (String)_event[1])); } } catch (Exception e) { throw new juggle.Exception(string.Format("process event, System.Exception:{0}", e)); } } } }