{"action":"created","issue":{"url":"https://api.github.com/repos/carllerche/mio/issues/219","labels_url":"https://api.github.com/repos/carllerche/mio/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/carllerche/mio/issues/219/comments","events_url":"https://api.github.com/repos/carllerche/mio/issues/219/events","html_url":"https://github.com/carllerche/mio/issues/219","id":97207138,"number":219,"title":"Does deregister clear events already pending delivery? Should it?","user":{"login":"dpc","id":9209,"avatar_url":"https://avatars.githubusercontent.com/u/9209?v=3","gravatar_id":"","url":"https://api.github.com/users/dpc","html_url":"https://github.com/dpc","followers_url":"https://api.github.com/users/dpc/followers","following_url":"https://api.github.com/users/dpc/following{/other_user}","gists_url":"https://api.github.com/users/dpc/gists{/gist_id}","starred_url":"https://api.github.com/users/dpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpc/subscriptions","organizations_url":"https://api.github.com/users/dpc/orgs","repos_url":"https://api.github.com/users/dpc/repos","events_url":"https://api.github.com/users/dpc/events{/privacy}","received_events_url":"https://api.github.com/users/dpc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-07-25T08:06:36Z","updated_at":"2015-08-03T17:23:32Z","closed_at":null,"body":"Let's say I have two event sources registered, both of them fired at the same time and landed in pending events list for current iteration.\r\n\r\nWhile handling the first event, I do `deregister` on the other one. Will I still get it? It seems to me that I will, which is very inconvenient, as it makes hard (impossible?) to safely deregister events other than the one that just fired.\r\n\r\nA spin of the above case is: What if I do `deregister` and right after used `register_opt` on different event source, using the same token.\r\n\r\nAnother spinoff is: What if I do `reregister` using different interest.\r\n\r\nIf I am not missing anything, it seems to me that either: the end of each event delivery iteration should have a notification, during which calls like `deregister` and `reregister` can be safely used, or `deregister` and `reregister` should make sure to remove any events that are not to be delivered anymore."},"comment":{"url":"https://api.github.com/repos/carllerche/mio/issues/comments/127336723","html_url":"https://github.com/carllerche/mio/issues/219#issuecomment-127336723","issue_url":"https://api.github.com/repos/carllerche/mio/issues/219","id":127336723,"user":{"login":"carllerche","id":6180,"avatar_url":"https://avatars.githubusercontent.com/u/6180?v=3","gravatar_id":"","url":"https://api.github.com/users/carllerche","html_url":"https://github.com/carllerche","followers_url":"https://api.github.com/users/carllerche/followers","following_url":"https://api.github.com/users/carllerche/following{/other_user}","gists_url":"https://api.github.com/users/carllerche/gists{/gist_id}","starred_url":"https://api.github.com/users/carllerche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carllerche/subscriptions","organizations_url":"https://api.github.com/users/carllerche/orgs","repos_url":"https://api.github.com/users/carllerche/repos","events_url":"https://api.github.com/users/carllerche/events{/privacy}","received_events_url":"https://api.github.com/users/carllerche/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T17:23:32Z","updated_at":"2015-08-03T17:23:32Z","body":"@dpc My point is, \"closing\" a socket is also \"deregisters\" the socket. However, since this entirely happens in the kernel, there is no way for mio to purge any pending events."}}