From 9bcc0722b3df9dea187e5b1dea96542016a82e71 Mon Sep 17 00:00:00 2001 From: ggggggggg Date: Thu, 13 Apr 2017 21:05:03 -0600 Subject: [PATCH 1/2] call get_events less often in send and recv --- src/ZMQ.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ZMQ.jl b/src/ZMQ.jl index 7b3e877..9b195be 100644 --- a/src/ZMQ.jl +++ b/src/ZMQ.jl @@ -498,8 +498,11 @@ function send(socket::Socket, zmsg::Message, SNDMORE::Bool=false) wait(socket) end else + notify_is_expensive = !isempty(socket.pollfd.notify.waitq) + if notify_is_expensive get_events(socket) != 0 && notify(socket) - break + end + break end end end @@ -530,8 +533,11 @@ function recv(socket::Socket) wait(socket) end else + notify_is_expensive = !isempty(socket.pollfd.notify.waitq) + if notify_is_expensive get_events(socket) != 0 && notify(socket) - break + end + break end end return zmsg From b5bc8bb46b94627eb740e79a1ff7db1050cf6b69 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Tue, 30 May 2017 10:11:29 -0700 Subject: [PATCH 2/2] use 4 space indent for consistency with the rest of the package --- src/ZMQ.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ZMQ.jl b/src/ZMQ.jl index 9b195be..3ef0b31 100644 --- a/src/ZMQ.jl +++ b/src/ZMQ.jl @@ -498,11 +498,11 @@ function send(socket::Socket, zmsg::Message, SNDMORE::Bool=false) wait(socket) end else - notify_is_expensive = !isempty(socket.pollfd.notify.waitq) - if notify_is_expensive - get_events(socket) != 0 && notify(socket) - end - break + notify_is_expensive = !isempty(socket.pollfd.notify.waitq) + if notify_is_expensive + get_events(socket) != 0 && notify(socket) + end + break end end end @@ -533,11 +533,11 @@ function recv(socket::Socket) wait(socket) end else - notify_is_expensive = !isempty(socket.pollfd.notify.waitq) - if notify_is_expensive - get_events(socket) != 0 && notify(socket) - end - break + notify_is_expensive = !isempty(socket.pollfd.notify.waitq) + if notify_is_expensive + get_events(socket) != 0 && notify(socket) + end + break end end return zmsg