-
Notifications
You must be signed in to change notification settings - Fork 0
thread
Lucio Santi edited this page Aug 3, 2014
·
4 revisions
PTC Wiki ▸ Code overview ▸ thread
This module implements the threads on which the protocol bases its operation:
- The
Clockthread is responsible for simulating the system clock. EveryCLOCK_TICKseconds (by default being 0.1), it will call thetickmethod defined byPTCProtocol(see protocol). - The
PacketReceiverthread monitors the socket and receives packets from it. Once a packet arrives, it will invoke thehandle_incomingmethod defined byPTCProtocol, which in turn will delegate its work to theIncomingPacketHandler(see handler). - Finally, the
PacketSenderthread sends data as well asFINpackets. This behavior is implemented by the methodhandle_outgoingonPTCProtocol, which is executed in the context of this thread every time that some event that might trigger new data to be sent occurs (e.g., incomingACKs orsendcalls performed by the user).