Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion c_src/erlzmq_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,27 @@ static void * polling_thread(void * handle)
for (;;) {
int count = zmq_poll(vector_p(zmq_pollitem_t, &items_zmq),
vector_count(&items_zmq), -1);
assert(count != -1);
if (count == -1) {
int error = zmq_errno();
if (error == EINTR) {
// The operation was interrupted by delivery of a signal before any events were available
continue;
} else if (error == ETERM) {
// At least one of the members of the items array refers to a socket whose associated ØMQ context was terminated.
fprintf(stderr, "context is termianted\n");
assert(0);
break;
} else if (error == EFAULT) {
fprintf(stderr, "invalid items providet to zmq_poll\n");
assert(0);
break;
} else {
fprintf(stderr, "unexpected error %d returned by zmq_poll\n", error);
assert(0);
break;
}
}

if (vector_get(zmq_pollitem_t, &items_zmq, 0)->revents & ZMQ_POLLIN) {
--count;
}
Expand Down Expand Up @@ -1229,6 +1249,7 @@ static void * polling_thread(void * handle)
}
}
}

return NULL;
}

Expand Down