Exemplo n.º 1
0
    public void InitSvc()
    {
        Instance = this;

        timer = new WZTimer();
        timer.SetLog((string info) =>
        {
            CommonTools.Log(info);
        });
    }
Exemplo n.º 2
0
    private static readonly string taskLock = "taskLock";             /*任务锁*/

    public void Init()
    {
        CommonTools.Log("TimerSvc Init ....");

        taskPackQueue.Clear();
        timer = new WZTimer(100);
        timer.SetHandle((Action <int> callback, int tid) =>
        {
            if (callback != null)
            {
                lock (taskLock)
                {
                    taskPackQueue.Enqueue(new TaskPack(tid, callback));
                }
            }
        });
        timer.SetLog((string info) => {
            CommonTools.Log(info);
        });
    }