commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 34/46: zeromq: Remove ZMQ_NOBLOCK as we are


From: git
Subject: [Commit-gnuradio] [gnuradio] 34/46: zeromq: Remove ZMQ_NOBLOCK as we are using polling
Date: Fri, 16 May 2014 19:37:16 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 49466c73743d1acf70a3e2d24e6dbc2a954f7271
Author: Johannes Schmitz <address@hidden>
Date:   Fri May 9 16:34:13 2014 +0200

    zeromq: Remove ZMQ_NOBLOCK as we are using polling
---
 gr-zeromq/include/gnuradio/zeromq/pub_sink.h   |  2 +-
 gr-zeromq/include/gnuradio/zeromq/push_sink.h  |  2 +-
 gr-zeromq/include/gnuradio/zeromq/rep_sink.h   |  2 +-
 gr-zeromq/include/gnuradio/zeromq/req_source.h |  2 +-
 gr-zeromq/lib/pub_sink_impl.cc                 | 10 +++++-----
 gr-zeromq/lib/pub_sink_impl.h                  |  3 +--
 gr-zeromq/lib/push_sink_impl.cc                | 10 +++++-----
 gr-zeromq/lib/push_sink_impl.h                 |  3 +--
 gr-zeromq/lib/rep_sink_impl.cc                 | 12 ++++++------
 gr-zeromq/lib/rep_sink_impl.h                  |  3 +--
 gr-zeromq/lib/req_source_impl.cc               | 10 +++++-----
 gr-zeromq/lib/req_source_impl.h                |  3 +--
 gr-zeromq/python/zeromq/qa_zeromq_pushpull.py  |  4 ++--
 gr-zeromq/python/zeromq/qa_zeromq_reqrep.py    |  4 ++--
 14 files changed, 33 insertions(+), 37 deletions(-)

diff --git a/gr-zeromq/include/gnuradio/zeromq/pub_sink.h 
b/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
index 46ad80b..483461d 100644
--- a/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
+++ b/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
@@ -53,7 +53,7 @@ namespace gr {
        * \param address  ZMQ socket address specifier
        * \param blocking Indicate whether blocking sends should be used, 
default true.
        */
-      static sptr make(size_t itemsize, size_t vlen, char *address, bool 
blocking=true);
+      static sptr make(size_t itemsize, size_t vlen, char *address);
     };
 
   } // namespace zeromq
diff --git a/gr-zeromq/include/gnuradio/zeromq/push_sink.h 
b/gr-zeromq/include/gnuradio/zeromq/push_sink.h
index 8fe849c..541993d 100644
--- a/gr-zeromq/include/gnuradio/zeromq/push_sink.h
+++ b/gr-zeromq/include/gnuradio/zeromq/push_sink.h
@@ -55,7 +55,7 @@ namespace gr {
        * \param blocking Indicate whether blocking sends should be used, 
default true.
        *
        */
-      static sptr make(size_t itemsize, size_t vlen, char *address, int 
timeout=100, bool blocking=true);
+      static sptr make(size_t itemsize, size_t vlen, char *address, int 
timeout=100);
     };
 
   } // namespace zeromq
diff --git a/gr-zeromq/include/gnuradio/zeromq/rep_sink.h 
b/gr-zeromq/include/gnuradio/zeromq/rep_sink.h
index 667612a..ab92c4d 100644
--- a/gr-zeromq/include/gnuradio/zeromq/rep_sink.h
+++ b/gr-zeromq/include/gnuradio/zeromq/rep_sink.h
@@ -54,7 +54,7 @@ namespace gr {
        * \param blocking Indicate whether blocking sends should be used, 
default true.
        *
        */
-      static sptr make(size_t itemsize, size_t vlen, char *address, int 
timeout=100, bool blocking=true);
+      static sptr make(size_t itemsize, size_t vlen, char *address, int 
timeout=100);
     };
 
   } // namespace zeromq
diff --git a/gr-zeromq/include/gnuradio/zeromq/req_source.h 
b/gr-zeromq/include/gnuradio/zeromq/req_source.h
index 31bd693..c272c28 100644
--- a/gr-zeromq/include/gnuradio/zeromq/req_source.h
+++ b/gr-zeromq/include/gnuradio/zeromq/req_source.h
@@ -52,7 +52,7 @@ namespace gr {
        * \param timeout  Receive timeout in seconds, default is 100ms, 1us 
increments
        *
        */
-      static sptr make(size_t itemsize, size_t vlen, char *address, int 
timeout=100, bool blocking=true);
+      static sptr make(size_t itemsize, size_t vlen, char *address, int 
timeout=100);
     };
 
   } // namespace zeromq
diff --git a/gr-zeromq/lib/pub_sink_impl.cc b/gr-zeromq/lib/pub_sink_impl.cc
index 3a86819..2749ddf 100644
--- a/gr-zeromq/lib/pub_sink_impl.cc
+++ b/gr-zeromq/lib/pub_sink_impl.cc
@@ -31,17 +31,17 @@ namespace gr {
   namespace zeromq {
 
     pub_sink::sptr
-    pub_sink::make(size_t itemsize, size_t vlen, char *address, bool blocking)
+    pub_sink::make(size_t itemsize, size_t vlen, char *address)
     {
       return gnuradio::get_initial_sptr
-        (new pub_sink_impl(itemsize, vlen, address, blocking));
+        (new pub_sink_impl(itemsize, vlen, address));
     }
 
-    pub_sink_impl::pub_sink_impl(size_t itemsize, size_t vlen, char *address, 
bool blocking)
+    pub_sink_impl::pub_sink_impl(size_t itemsize, size_t vlen, char *address)
       : gr::sync_block("pub_sink",
                        gr::io_signature::make(1, 1, itemsize * vlen),
                        gr::io_signature::make(0, 0, 0)),
-        d_itemsize(itemsize), d_vlen(vlen), d_blocking(blocking)
+        d_itemsize(itemsize), d_vlen(vlen)
     {
       d_context = new zmq::context_t(1);
       d_socket = new zmq::socket_t(*d_context, ZMQ_PUB);
@@ -68,7 +68,7 @@ namespace gr {
       // create message copy and send
       zmq::message_t msg(d_itemsize*d_vlen*noutput_items);
       memcpy((void *)msg.data(), in, d_itemsize*d_vlen*noutput_items);
-      d_socket->send(msg, d_blocking ? 0 : ZMQ_NOBLOCK);
+      d_socket->send(msg);
 
       return noutput_items;
     }
diff --git a/gr-zeromq/lib/pub_sink_impl.h b/gr-zeromq/lib/pub_sink_impl.h
index ad0419a..bf5abdb 100644
--- a/gr-zeromq/lib/pub_sink_impl.h
+++ b/gr-zeromq/lib/pub_sink_impl.h
@@ -34,12 +34,11 @@ namespace gr {
     private:
       size_t          d_itemsize;
       size_t          d_vlen;
-      bool            d_blocking;
       zmq::context_t  *d_context;
       zmq::socket_t   *d_socket;
 
     public:
-      pub_sink_impl(size_t itemsize, size_t vlen, char *address, bool 
blocking);
+      pub_sink_impl(size_t itemsize, size_t vlen, char *address);
       ~pub_sink_impl();
 
       int work(int noutput_items,
diff --git a/gr-zeromq/lib/push_sink_impl.cc b/gr-zeromq/lib/push_sink_impl.cc
index 2df3a6f..2f7e4ce 100644
--- a/gr-zeromq/lib/push_sink_impl.cc
+++ b/gr-zeromq/lib/push_sink_impl.cc
@@ -31,17 +31,17 @@ namespace gr {
   namespace zeromq {
 
     push_sink::sptr
-    push_sink::make(size_t itemsize, size_t vlen, char *address, int timeout, 
bool blocking)
+    push_sink::make(size_t itemsize, size_t vlen, char *address, int timeout)
     {
       return gnuradio::get_initial_sptr
-        (new push_sink_impl(itemsize, vlen, address, timeout, blocking));
+        (new push_sink_impl(itemsize, vlen, address, timeout));
     }
 
-    push_sink_impl::push_sink_impl(size_t itemsize, size_t vlen, char 
*address, int timeout, bool blocking)
+    push_sink_impl::push_sink_impl(size_t itemsize, size_t vlen, char 
*address, int timeout)
       : gr::sync_block("push_sink",
                        gr::io_signature::make(1, 1, itemsize * vlen),
                        gr::io_signature::make(0, 0, 0)),
-        d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout), 
d_blocking(blocking)
+        d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout)
     {
       d_context = new zmq::context_t(1);
       d_socket = new zmq::socket_t(*d_context, ZMQ_PUSH);
@@ -73,7 +73,7 @@ namespace gr {
         // create message copy and send
         zmq::message_t msg(d_itemsize*d_vlen*noutput_items);
         memcpy((void *)msg.data(), in, d_itemsize*d_vlen*noutput_items);
-        d_socket->send(msg, d_blocking ? 0 : ZMQ_NOBLOCK);
+        d_socket->send(msg);
 
         return noutput_items;
       }
diff --git a/gr-zeromq/lib/push_sink_impl.h b/gr-zeromq/lib/push_sink_impl.h
index 2ff9bc5..9a10065 100644
--- a/gr-zeromq/lib/push_sink_impl.h
+++ b/gr-zeromq/lib/push_sink_impl.h
@@ -35,12 +35,11 @@ namespace gr {
       size_t          d_itemsize;
       size_t          d_vlen;
       float           d_timeout;
-      bool            d_blocking;
       zmq::context_t  *d_context;
       zmq::socket_t   *d_socket;
 
     public:
-      push_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, 
bool blocking);
+      push_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout);
       ~push_sink_impl();
 
       int work(int noutput_items,
diff --git a/gr-zeromq/lib/rep_sink_impl.cc b/gr-zeromq/lib/rep_sink_impl.cc
index 35efffa..9f73fb1 100644
--- a/gr-zeromq/lib/rep_sink_impl.cc
+++ b/gr-zeromq/lib/rep_sink_impl.cc
@@ -31,17 +31,17 @@ namespace gr {
   namespace zeromq {
 
     rep_sink::sptr
-    rep_sink::make(size_t itemsize, size_t vlen, char *address, int timeout, 
bool blocking)
+    rep_sink::make(size_t itemsize, size_t vlen, char *address, int timeout)
     {
       return gnuradio::get_initial_sptr
-        (new rep_sink_impl(itemsize, vlen, address, timeout, blocking));
+        (new rep_sink_impl(itemsize, vlen, address, timeout));
     }
 
-    rep_sink_impl::rep_sink_impl(size_t itemsize, size_t vlen, char *address, 
int timeout, bool blocking)
+    rep_sink_impl::rep_sink_impl(size_t itemsize, size_t vlen, char *address, 
int timeout)
       : gr::sync_block("rep_sink",
                        gr::io_signature::make(1, 1, itemsize * vlen),
                        gr::io_signature::make(0, 0, 0)),
-        d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout), 
d_blocking(blocking)
+        d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout)
     {
       d_context = new zmq::context_t(1);
       d_socket = new zmq::socket_t(*d_context, ZMQ_REP);
@@ -79,14 +79,14 @@ namespace gr {
         if (noutput_items < req_output_items) {
           zmq::message_t msg(d_itemsize*d_vlen*noutput_items);
           memcpy((void *)msg.data(), in, d_itemsize*d_vlen*noutput_items);
-          d_socket->send(msg, d_blocking ? 0 : ZMQ_NOBLOCK);
+          d_socket->send(msg);
 
           return noutput_items;
         }
         else {
           zmq::message_t msg(d_itemsize*d_vlen*req_output_items);
           memcpy((void *)msg.data(), in, d_itemsize*d_vlen*req_output_items);
-          d_socket->send(msg, d_blocking ? 0 : ZMQ_NOBLOCK);
+          d_socket->send(msg);
 
           return req_output_items;
         }
diff --git a/gr-zeromq/lib/rep_sink_impl.h b/gr-zeromq/lib/rep_sink_impl.h
index 500af7a..ff69735 100644
--- a/gr-zeromq/lib/rep_sink_impl.h
+++ b/gr-zeromq/lib/rep_sink_impl.h
@@ -35,12 +35,11 @@ namespace gr {
       size_t          d_itemsize;
       size_t          d_vlen;
       int             d_timeout;
-      bool            d_blocking;
       zmq::context_t  *d_context;
       zmq::socket_t   *d_socket;
 
     public:
-      rep_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, 
bool blocking);
+      rep_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout);
       ~rep_sink_impl();
 
       int work(int noutput_items,
diff --git a/gr-zeromq/lib/req_source_impl.cc b/gr-zeromq/lib/req_source_impl.cc
index 121d2e3..3cbe6ed 100644
--- a/gr-zeromq/lib/req_source_impl.cc
+++ b/gr-zeromq/lib/req_source_impl.cc
@@ -31,17 +31,17 @@ namespace gr {
   namespace zeromq {
 
     req_source::sptr
-    req_source::make(size_t itemsize, size_t vlen, char *address, int timeout, 
bool blocking)
+    req_source::make(size_t itemsize, size_t vlen, char *address, int timeout)
     {
       return gnuradio::get_initial_sptr
-        (new req_source_impl(itemsize, vlen, address, timeout, blocking));
+        (new req_source_impl(itemsize, vlen, address, timeout));
     }
 
-    req_source_impl::req_source_impl(size_t itemsize, size_t vlen, char 
*address, int timeout, bool blocking)
+    req_source_impl::req_source_impl(size_t itemsize, size_t vlen, char 
*address, int timeout)
       : gr::sync_block("req_source",
                        gr::io_signature::make(0, 0, 0),
                        gr::io_signature::make(1, 1, itemsize * vlen)),
-        d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout), 
d_blocking(blocking)
+        d_itemsize(itemsize), d_vlen(vlen), d_timeout(timeout)
     {
       d_context = new zmq::context_t(1);
       d_socket = new zmq::socket_t(*d_context, ZMQ_REQ);
@@ -73,7 +73,7 @@ namespace gr {
         // Request data, FIXME non portable?
         zmq::message_t request(sizeof(int));
         memcpy ((void *) request.data (), &noutput_items, sizeof(int));
-        d_socket->send(request, d_blocking ? 0 : ZMQ_NOBLOCK);
+        d_socket->send(request);
       }
 
       zmq::pollitem_t itemsin[] = { { *d_socket, 0, ZMQ_POLLIN, 0 } };
diff --git a/gr-zeromq/lib/req_source_impl.h b/gr-zeromq/lib/req_source_impl.h
index ab844ef..f61b1d1 100644
--- a/gr-zeromq/lib/req_source_impl.h
+++ b/gr-zeromq/lib/req_source_impl.h
@@ -35,12 +35,11 @@ namespace gr {
       size_t          d_itemsize;
       size_t          d_vlen;
       int             d_timeout;
-      bool            d_blocking;
       zmq::context_t  *d_context;
       zmq::socket_t   *d_socket;
 
     public:
-      req_source_impl(size_t itemsize, size_t vlen, char *address, int 
timeout, bool blocking);
+      req_source_impl(size_t itemsize, size_t vlen, char *address, int 
timeout);
       ~req_source_impl();
 
       int work(int noutput_items,
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py 
b/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py
index 637edf8..457c524 100755
--- a/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py
@@ -34,8 +34,8 @@ class qa_zeromq_pushpull (gr_unittest.TestCase):
         print "test_001_t"
         src_data = [1,2,3,4,5,6,7,8,9,0]*100
         src = blocks.vector_source_c(src_data, False, 1)
-        zeromq_push_sink = zeromq.push_sink(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", True)
-        zeromq_pull_source = zeromq.pull_source(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", 0, True)
+        zeromq_push_sink = zeromq.push_sink(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555")
+        zeromq_pull_source = zeromq.pull_source(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", 0)
         sink = blocks.vector_sink_c()
         self.tb.connect(src, zeromq_push_sink)
         self.tb.connect(zeromq_pull_source, sink)
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py 
b/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py
index a577d90..e2c14eb 100755
--- a/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py
@@ -37,8 +37,8 @@ class qa_zeromq_reqrep (gr_unittest.TestCase):
         print "test_001_t"
         src_data = [1,2,3,4,5,6,7,8,9,0]*100
         src = blocks.vector_source_c(src_data, False, 1)
-        zeromq_rep_sink = zeromq.rep_sink(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", 0, False)
-        zeromq_req_source = zeromq.req_source(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", 0, False)
+        zeromq_rep_sink = zeromq.rep_sink(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", 0)
+        zeromq_req_source = zeromq.req_source(gr.sizeof_gr_complex, 10, 
"tcp://127.0.0.1:5555", 0)
         sink = blocks.vector_sink_c()
         self.tb.connect(src, zeromq_rep_sink)
         self.tb.connect(zeromq_req_source, sink)



reply via email to

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