コード例 #1
0
ファイル: TimerSvc.cs プロジェクト: wangzhenGitHup/U3D
    public void InitSvc()
    {
        Instance = this;

        timer = new WZTimer();
        timer.SetLog((string info) =>
        {
            CommonTools.Log(info);
        });
    }
コード例 #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);
        });
    }