gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10815: Port to windows, using the m


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10815: Port to windows, using the mingw32 select() instead of ppoll().
Date: Mon, 20 Apr 2009 16:30:53 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10815
committer: address@hidden
branch nick: trunk
timestamp: Mon 2009-04-20 16:30:53 -0600
message:
  Port to windows, using the mingw32 select() instead of ppoll().
modified:
  libnet/network.cpp
  libnet/network.h
=== modified file 'libnet/network.cpp'
--- a/libnet/network.cpp        2009-03-30 23:24:05 +0000
+++ b/libnet/network.cpp        2009-04-20 22:30:53 +0000
@@ -1209,6 +1209,10 @@
        return hits;
     }
     
+    int timeout = _timeout;
+    if (timeout <= 0) {
+       timeout = 5;
+    }
 #ifdef HAVE_PPOLL
        struct timespec tval;
        sigset_t pending, blockset;
@@ -1227,7 +1231,15 @@
            sigwait(&blockset, &sig);
        }
 #else
+#ifdef HAVE_POLL_H
        int ret = poll(fds, limit, _timeout);
+#else
+       fd_set fdset;
+       struct timeval        tval;
+       tval.tv_sec = timeout;
+       tval.tv_usec = 0;
+       int ret = select(limit+1, &fdset, NULL, NULL, &tval);
+#endif
 #endif
 
     log_debug("Poll returned: %d, timeout is: %d", ret, _timeout);
@@ -1350,18 +1362,19 @@
     tval.tv_sec = timeout;
     tval.tv_usec = 0;
     int ret = select(limit+1, &fdset, NULL, NULL, &tval);
+    FD_ZERO(&fdset);
 #endif
     // If interupted by a system call, try again
     if (ret == -1 && errno == EINTR) {
-       log_error (_("Waiting for data for fdset 0x%x was interupted by a 
system call"), reinterpret_cast<long>(fdset.fds_bits));
+       log_error (_("Waiting for data was interupted by a system call"));
     }
     
     if (ret == -1) {
-       log_error (_("Waiting for data for fdset  0x%x was never available for 
reading"), reinterpret_cast<long>(fdset.fds_bits));
+       log_error (_("Waiting for data for fdset, was never available for 
reading"));
     }
     
     if (ret == 0) {
-       log_debug (_("Waiting for data for fdset  0x%x timed out waiting for 
data"), reinterpret_cast<long>(fdset.fds_bits));
+       log_debug (_("Waiting for data for fdset, timed out waiting for data"));
        FD_ZERO(&fdset);
     }
 

=== modified file 'libnet/network.h'
--- a/libnet/network.h  2009-03-06 01:10:48 +0000
+++ b/libnet/network.h  2009-04-20 22:30:53 +0000
@@ -78,6 +78,15 @@
   typedef int    socklen_t;
 #endif
 
+#if defined(HAVE_POLL_H) || defined(HAVE_PPOLL)
+#include <poll.h>
+#else
+struct pollfd {
+    int   fd; 
+    short events;
+    short revents;
+};
+#endif
 
 /// \class Network
 ///    This is a low level network class for Gnash and Cygnal. This
@@ -191,9 +200,7 @@
     /// @param limit The max number of file descriptors to wait for.
     ///
     /// @return A vector of the file descriptors that have activity.
-#ifdef HAVE_POLL_H
     boost::shared_ptr<std::vector<struct pollfd> > waitForNetData(int limit, 
struct pollfd *fds);
-#endif
     fd_set waitForNetData(int limit, fd_set data);
     fd_set waitForNetData(std::vector<int> &data);
        
@@ -273,11 +280,9 @@
     /// \var Handler::_handlers
     ///                Keep a list of all active network connections
     std::map<int, entry_t *> _handlers;
-#ifdef HAVE_POLL_H
     std::vector<struct pollfd> _pollfds;
     // This is the mutex that controls access to the que.
     boost::mutex       _poll_mutex;
-#endif
 };
 
 } // end of gnash namespace


reply via email to

[Prev in Thread] Current Thread [Next in Thread]