コード例 #1
0
        private static void Main(String[] args)
        {
            if (args.Length <= 0)
            {
                return;
            }

            gate _gate = new gate(args);

            Int64 oldtick = 0;
            Int64 tick    = 0;

            while (true)
            {
                oldtick = tick;
                tick    = _gate.poll();

                if (closeHandle.is_close)
                {
                    log.log.operation(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "server closed, gate server:{0}", gate.uuid);
                    break;
                }

                Int64 ticktime = (tick - oldtick);
                if (ticktime < 50)
                {
                    Thread.Sleep(15);
                }
            }
        }
コード例 #2
0
ファイル: gate.cs プロジェクト: micules/abelkhan
        private static void Main(String[] args)
        {
            if (args.Length <= 0)
            {
                return;
            }

            gate _gate = new gate(args);

            Int64 tick      = Environment.TickCount;
            Int64 tickcount = 0;

            while (true)
            {
                Int64 tmptick = (Environment.TickCount & UInt32.MaxValue);
                if (tmptick < tick)
                {
                    tickcount += 1;
                    tmptick    = tmptick + tickcount * UInt32.MaxValue;
                }
                tick = tmptick;

                _gate.poll(tick);

                if (closeHandle.is_close)
                {
                    Console.WriteLine("server closed, hub server " + gate.uuid);
                    break;
                }

                tmptick = (Environment.TickCount & UInt32.MaxValue);
                if (tmptick < tick)
                {
                    tickcount += 1;
                    tmptick    = tmptick + tickcount * UInt32.MaxValue;
                }
                Int64 ticktime = (tmptick - tick);
                tick = tmptick;

                if (ticktime < 50)
                {
                    Thread.Sleep(15);
                }
            }
        }