static TransportManager() { var m = new ExecutorWorker("networkManager"); m.Init(); worker = m; worker.RegisterEventHandler((int)NetworkWorkerEvent.QUEUE_SEND_MSG, OnQueueSendMsg); worker.RegisterEventHandler((int)NetworkWorkerEvent.CONTINUE_SEND_MSG, OnContinueSendMsg); worker.RegisterEventHandler((int)NetworkWorkerEvent.ADD_NETWORK_CONN, OnAddNetworkConn); worker.RegisterEventHandler((int)NetworkWorkerEvent.REMOVE_NETWORK_CONN, OnRemoveNetworkConn); }
public static Executor Get(string name) { var m = workerMap.GetOrAdd(name, (string name) => { ExecutorWorker worker = new ExecutorWorker(name); if (Interlocked.CompareExchange(ref inited, 1, 1) == 1) { worker.Init(); } return(worker); }); return(m); }
internal void Init(ExecutorWorker m) { this.m = m; }