[ENet-discuss] enet multi-thread

Eric Young evilbrave at gmail.com
Sun Jul 19 04:28:55 PDT 2015


In my program, the main thread is to loop "enet_host_service" for receiving
enet packets
other threads are used to process some data and will send enet packets by
"enet_packet_send"
Dose this design cause Critical Section in enet list data structure?
--------------------------------------------------------------------------------
enet_list_insert (ENetListIterator position, void * data)
{
   ENetListIterator result = (ENetListIterator) data;

   result -> previous = position -> previous;
   result -> next = position;

   result -> previous -> next = result;
   position -> previous = result;

   return result;
}

void *
enet_list_remove (ENetListIterator position)
{
   position -> previous -> next = position -> next;
   position -> next -> previous = position -> previous;

   return position;
}
---------------------------------------------------------------------------------
If yes, how do i avoid that? Does anyone fork enet to deal with this?
Thanks a lot!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20150719/31d6c18d/attachment.html>


More information about the ENet-discuss mailing list