<p dir="ltr">I just give up the enet_host_flush and<br>
shorten the delay of enet_host_service to 20ms ,all sending and reception just by itself </p>
<div class="gmail_quote">ÔÚ 2013-5-4 ÉÏÎç3:00£¬ <<a href="mailto:enet-discuss-request@cubik.org">enet-discuss-request@cubik.org</a>>дµÀ£º<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Send ENet-discuss mailing list submissions to<br>
<a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:enet-discuss-request@cubik.org">enet-discuss-request@cubik.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:enet-discuss-owner@cubik.org">enet-discuss-owner@cubik.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of ENet-discuss digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. dangerous about function enet_host_flush (<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>)<br>
2. Re: dangerous about function enet_host_flush (Ruud van Gaal)<br>
3. Re: dangerous about function enet_host_flush (Syed Setia Pernama)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 3 May 2013 17:49:59 +0800<br>
From: "<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>" <<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>><br>
To: enet-discuss <<a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a>><br>
Subject: [ENet-discuss] dangerous about function enet_host_flush<br>
Message-ID: <<a href="mailto:201305031749569964678@gmail.com">201305031749569964678@gmail.com</a>><br>
Content-Type: text/plain; charset="gb2312"<br>
<br>
<br>
when I use two different threads for receive package and send package I found that when I use enet_host_flush in send thread may occur Thread synchronization problem randomly, because enet_host_flush and enet_host_service may call the enet_protocol_send_outgoing_commands function at the sametime?even I use the pthread_mutex_t in my threads it`s crash randomly anyway!<br>
<br>
<br>
<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20130503/a1d4d2d6/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20130503/a1d4d2d6/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 3 May 2013 12:43:18 +0200<br>
From: Ruud van Gaal <<a href="mailto:ruud@racer.nl">ruud@racer.nl</a>><br>
To: zxz3121 <<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>>, Discussion of the ENet library<br>
<<a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a>><br>
Subject: Re: [ENet-discuss] dangerous about function enet_host_flush<br>
Message-ID:<br>
<<a href="mailto:CADULfbMjcuyvfjWwOT2MU475FvMPO9V5XANSHaYXLBDPjMYBmQ@mail.gmail.com">CADULfbMjcuyvfjWwOT2MU475FvMPO9V5XANSHaYXLBDPjMYBmQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
ENet isn't thread-safe, as you found out.<br>
<br>
<br>
On Fri, May 3, 2013 at 11:49 AM, <a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a> <<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>>wrote:<br>
<br>
> **<br>
><br>
> when I use two different threads for receive package and send package I<br>
> found that when I use enet_host_flush in send thread may occur<br>
> Thread synchronization problem randomly, because enet_host_flush and<br>
> enet_host_service may call the enet_protocol_send_outgoing_commands<br>
> function at the sametime?even I use the pthread_mutex_t in my threads<br>
> it`s crash randomly anyway!<br>
> ------------------------------<br>
> <a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a><br>
><br>
> _______________________________________________<br>
> ENet-discuss mailing list<br>
> <a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
> <a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20130503/6e09c2f1/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20130503/6e09c2f1/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Fri, 3 May 2013 04:52:39 -0700 (PDT)<br>
From: Syed Setia Pernama <<a href="mailto:syedhs@yahoo.com">syedhs@yahoo.com</a>><br>
To: Discussion of the ENet library <<a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a>><br>
Subject: Re: [ENet-discuss] dangerous about function enet_host_flush<br>
Message-ID:<br>
<<a href="mailto:1367581959.99748.YahooMailNeo@web125702.mail.ne1.yahoo.com">1367581959.99748.YahooMailNeo@web125702.mail.ne1.yahoo.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Provide two queues, one is for sending and another is for packet receiption. Both queues must have thread safety.<br>
<br>
<br>
<br>
________________________________<br>
From: Ruud van Gaal <<a href="mailto:ruud@racer.nl">ruud@racer.nl</a>><br>
To: zxz3121 <<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>>; Discussion of the ENet library <<a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a>><br>
Sent: Friday, May 3, 2013 6:43 PM<br>
Subject: Re: [ENet-discuss] dangerous about function enet_host_flush<br>
<br>
<br>
<br>
ENet isn't thread-safe, as you found out.<br>
<br>
<br>
<br>
<br>
On Fri, May 3, 2013 at 11:49 AM, <a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a> <<a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a>> wrote:<br>
<br>
<br>
>?<br>
>when I use?two different?threads for receive package and send<br>
package? I found that when I use enet_host_flush in send thread may occur<br>
Thread?synchronization??problem? randomly, because<br>
enet_host_flush? and enet_host_service may? call the?<br>
enet_protocol_send_outgoing_commands? function? at the sametime?even I<br>
use the pthread_mutex_t? in my threads it`s crash randomly anyway!<br>
>________________________________<br>
><a href="mailto:zxz3121@gmail.com">zxz3121@gmail.com</a><br>
>_______________________________________________<br>
>ENet-discuss mailing list<br>
><a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
><a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
><br>
><br>
<br>
_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cubik.org/pipermail/enet-discuss/attachments/20130503/f0e8a722/attachment-0001.html" target="_blank">http://lists.cubik.org/pipermail/enet-discuss/attachments/20130503/f0e8a722/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br>
<br>
End of ENet-discuss Digest, Vol 119, Issue 4<br>
********************************************<br>
</blockquote></div>