Threads in Diarkis
This document explains the threads used by the Diarkis client.
This page explains the threads used in Diarkis. The threads of the Diarkis Module are created during the initialization of DiarkisInterfaceBase::DiarkisInit()
. When IDiarkisTransport::Connect()
is called, the UDP/TCP/P2P threads are created. The number of runtime library threads will increase according to the Diarkis server you are connecting to.
Runtime Library
When connecting to a UDP server, the following two threads are created:
Send Thread: A thread for sending packets accumulated in the Send Pending Buffer.
Receive Thread: A thread for pushing events into the Event Scheduler from packets received by the socket.
When connecting to a TCP server, the following thread is created:
Network Thread: A thread for sending and receiving packets.
When connecting via P2P, the following thread is created for each connection peer:
Holepunch Thread: A temporary thread created when performing hole punching.
Diarkis Module
Runtime Thread: A thread for invoking response/notification events from the Diarkis server.
Logger Backend Thread: A thread for buffering and processing logs from Diarkis.
Thread Sequence Diagram for UDP Connection
In Case Multiple Diarkis Servers Are Needed
For instance, if you need to prepare both a matching server and a TURN server using UDP
, you need to prepare two instances of DiarkisInterfaceBase
. Consequently, four threads will be created for the runtime library (Send Thread
and Receive Thread
each x2).
Even in this case, only one of each thread for the Diarkis Module (Runtime Thread
and Logger Backend Thread
) is created, resulting in a total of 6 threads (2 for matching, 2 for TURN, 2 for Diarkis Module). When using P2P connections, temporary threads will be created for each peer connection.
最終更新