Multi-threading strategy for ENet
masterENet is generally not thread-safe. The recommended strategy is to run ENet in an independent I/O thread and use inter-thread messaging (like a non-blocking Ring Buffer) to transfer data between the I/O thread and your main logic/worker threads.
Thread-safe elements:
Packetstructures are safe as long as they are moved across threads by value and a custom memory allocator is not being used.Peer.IDis cached in thePeerstructure and is safe to access once obtained.Library.Timeuses atomic primitives and is safe to call.