[ENet-discuss] server crashes when calling enet_host_flush() from other thread

aj3423 aj3423 at gmail.com
Thu Jan 21 22:27:08 PST 2016


My server should receive message from client and echo back some message,
but in my case building the message packet costs time, so I need to create
a thread to echo message to clients.

I wrote a test to illustrate this problem, the client runs a infinit loop,
sending 2k data to server and receive 2k data. The server crashes after a
while, randomly. the code:

server: http://pastebin.com/99kpQgTJ
client:  http://pastebin.com/wX8jfZgk

It crashes at function *enet_host_flush*, I tried to use `std::mutex` but
doesn't help. Any idea? Thanks.

My Environment: Win7 32bit + VS2013 + Enet 1.3.13
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20160122/77d0bc92/attachment.html>


More information about the ENet-discuss mailing list