]> git.saurik.com Git - wxWidgets.git/commitdiff
handle 0 timeout in RunLoop() correctly
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Mar 2007 02:29:49 +0000 (02:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Mar 2007 02:29:49 +0000 (02:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/selectdispatcher.cpp

index f58665f8ee89b9f33f8eb00fcad5f3efacb423d3..5ee2f0242df4bcc4b8f495c78f7edb36a250f84f 100644 (file)
@@ -198,13 +198,19 @@ void wxSelectDispatcher::RunLoop(int timeout)
         fd_set writeset = m_writeset;
         fd_set exeptset = m_exeptset;
         wxStopWatch sw;
-        if ( ptv )
+        if ( ptv && timeout )
           sw.Start(ptv->tv_usec/10);
         ret = select(m_maxFD+1, &readset, &writeset, &exeptset, ptv);
         switch ( ret )
         {
             // TODO: handle unix signals here
             case -1:
+                if ( !timeout )
+                {
+                    // it doesn't make sense to remain here
+                    return;
+                }
+
                 if ( ptv )
                 {
                     ptv->tv_sec = 0;