MidLevel / Ruffles

Lightweight and fully managed reliable UDP library.
MIT License
212 stars 28 forks source link

SendTo sync with main thread #23

Open dungeon2567 opened 4 years ago

dungeon2567 commented 4 years ago

Is your feature request related to a problem? Please describe. Can SendTo be triggered by the main thread? i have a game loop on my game server and want to send all messages at the end of every step Describe the solution you'd like Main Thread trigger Event at end of loop, SendTo Thread "WaitsFor" Event to run logic

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

TwoTenPvP commented 4 years ago

All API's in Ruffles are 100% thread safe and many are threaded under the hood already.

dungeon2567 commented 4 years ago

Yes, they are thread safe but i want to send all messages exactly on the end of current server tick to optimize latency (my server is already 20 fps, 50 ms per frame)

dungeon2567 commented 4 years ago

Is there anything wrong with this? because even even though both threads run at 20 ticks per second they are not in sync (i write all data that need to be sent this frame before the frame end and i can flush it now)