Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        public Network(Host host)
        {
            Host = host;

            _SlistSendProcedure = new PollProcedure(null, 0.0, SlistSend, null);
            _SlistPollProcedure = new PollProcedure(null, 0.0, SlistPoll, null);

            // Temporary workaround will sort out soon
            NetworkWrapper.OnGetLanDriver += (index) =>
            {
                return(LanDrivers[index]);
            };
        }
Exemplo n.º 4
0
        /// <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);
            }
        }
Exemplo n.º 5
0
        /// <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);
            }
        }
Exemplo n.º 6
0
        public PollHandler procedure; // void (*procedure)();

        #endregion Fields

        #region Constructors

        public PollProcedure(PollProcedure next, double nextTime, PollHandler handler, object arg)
        {
            this.next = next;
            this.nextTime = nextTime;
            this.procedure = handler;
            this.arg = arg;
        }
Exemplo n.º 7
0
        /// <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;
        }