summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/select.cpp b/src/select.cpp
index be5cd47..7345cbb 100644
--- a/src/select.cpp
+++ b/src/select.cpp
@@ -217,10 +217,13 @@ void zmq::select_t::loop ()
// Destroy retired event sources.
if (retired) {
- for (fd_set_t::size_type i = 0; i < fds.size (); i ++) {
- if (fds [i].fd == retired_fd) {
- fds.erase (fds.begin () + i);
- i --;
+ fd_set_t::iterator it = fds.begin();
+ while (it != fds.end()) {
+ if (it->fd == retired_fd) {
+ it = fds.erase(it);
+ }
+ else {
+ it++;
}
}
retired = false;