예제 #1
0
파일: Net.cs 프로젝트: Scrama/Quarp
        public object arg;            // void *arg

        public PollProcedure(PollProcedure next, double nextTime, PollHandler handler, object arg)
        {
            this.next      = next;
            this.nextTime  = nextTime;
            this.procedure = handler;
            this.arg       = arg;
        }
예제 #2
0
파일: Net.cs 프로젝트: Scrama/Quarp
        /// <summary>
        /// NET_Poll
        /// </summary>
        public static void Poll()
        {
            SetNetTime();

            for (PollProcedure pp = _PollProcedureList; pp != null; pp = pp.next)
            {
                if (pp.nextTime > _Time)
                {
                    break;
                }

                _PollProcedureList = pp.next;
                pp.procedure(pp.arg);
            }
        }
예제 #3
0
파일: Net.cs 프로젝트: Scrama/Quarp
        /// <summary>
        /// SchedulePollProcedure
        /// </summary>
        static void SchedulePollProcedure(PollProcedure proc, double timeOffset)
        {
            proc.nextTime = Sys.GetFloatTime() + timeOffset;
            PollProcedure pp, prev;

            for (pp = _PollProcedureList, prev = null; pp != null; pp = pp.next)
            {
                if (pp.nextTime >= proc.nextTime)
                {
                    break;
                }
                prev = pp;
            }

            if (prev == null)
            {
                proc.next          = _PollProcedureList;
                _PollProcedureList = proc;
                return;
            }

            proc.next = pp;
            prev.next = proc;
        }