VisualStudio/C#서버

[C#서버] Thread.sleep 사용하지 않고 특정시간마다 이벤트 발생방법

usingsystem 2022. 11. 2. 14:59
728x90

250밀리세컨 마다 특정 이벤트 실행

   int roomTick = 0;
            while (true)
            {
                int now = Environment.TickCount;
                if (roomTick < now)
                {
                    Room.Push(() => { Room.Flush(); });
                    roomTick = now + 250;
                }

            }

 

728x90