|
From: Josep S. <jsa...@gm...> - 2008-07-07 19:05:11
|
Hi, tv_zero makes select() return immediately, so there is no obvious deadlock possibility here. What makes select() block indefinitely is passing a null timeout value, which is exactly what this commit fixes :) Regards, Josep On Thu, Jul 3, 2008 at 2:23 AM, Marco Canini <mar...@fa...> wrote: > Does using tv_zero here conduce to a deadlock? > > jsa...@us... wrote: >> >> Revision: 1261 >> http://como.svn.sourceforge.net/como/?rev=1261&view=rev >> Author: jsanjuas >> Date: 2008-07-02 17:08:22 -0700 (Wed, 02 Jul 2008) >> >> Log Message: >> ----------- >> fixing previous commit >> >> Modified Paths: >> -------------- >> src/branches/2.0/base/capture.c >> >> Modified: src/branches/2.0/base/capture.c >> =================================================================== >> --- src/branches/2.0/base/capture.c 2008-07-02 22:52:05 UTC (rev 1260) >> +++ src/branches/2.0/base/capture.c 2008-07-03 00:08:22 UTC (rev 1261) >> @@ -1686,6 +1686,7 @@ >> sniffer_t *sniff; >> sniffer_list_t *sniffers; >> int messages_recvd = 0; >> + struct timeval tv_zero = { 0, 0 }; >> log_set_program("CA"); >> @@ -1832,7 +1833,9 @@ >> * if we just received some messages, don't sleep as we want >> * to immediately check if we have more of them. >> */ >> - if (active_sniff > 0 && ! messages_recvd) >> + if (messages_recvd) >> + event_loop_set_timeout(como_ca.el, &tv_zero); >> + else if (active_sniff > 0) >> event_loop_set_timeout(como_ca.el, &timeout); >> #ifdef LOADSHED >> >> >> This was sent by the SourceForge.net collaborative development platform, >> the world's largest Open Source development site. >> >> ------------------------------------------------------------------------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source project, >> along with a healthy diet, reduces your potential for chronic lameness >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >> _______________________________________________ >> Como-commits mailing list >> Com...@li... >> https://lists.sourceforge.net/lists/listinfo/como-commits >> > > > -- > Marco Canini > |