{"action":"created","issue":{"url":"https://api.github.com/repos/hannobraun/inotify-rs/issues/29","labels_url":"https://api.github.com/repos/hannobraun/inotify-rs/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/hannobraun/inotify-rs/issues/29/comments","events_url":"https://api.github.com/repos/hannobraun/inotify-rs/issues/29/events","html_url":"https://github.com/hannobraun/inotify-rs/pull/29","id":114352912,"number":29,"title":"Allow asynchronous closing.","user":{"login":"benschulz","id":10342420,"avatar_url":"https://avatars.githubusercontent.com/u/10342420?v=3","gravatar_id":"","url":"https://api.github.com/users/benschulz","html_url":"https://github.com/benschulz","followers_url":"https://api.github.com/users/benschulz/followers","following_url":"https://api.github.com/users/benschulz/following{/other_user}","gists_url":"https://api.github.com/users/benschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/benschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benschulz/subscriptions","organizations_url":"https://api.github.com/users/benschulz/orgs","repos_url":"https://api.github.com/users/benschulz/repos","events_url":"https://api.github.com/users/benschulz/events{/privacy}","received_events_url":"https://api.github.com/users/benschulz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-30T20:45:47Z","updated_at":"2015-11-03T20:20:42Z","closed_at":"2015-11-03T16:06:27Z","pull_request":{"url":"https://api.github.com/repos/hannobraun/inotify-rs/pulls/29","html_url":"https://github.com/hannobraun/inotify-rs/pull/29","diff_url":"https://github.com/hannobraun/inotify-rs/pull/29.diff","patch_url":"https://github.com/hannobraun/inotify-rs/pull/29.patch"},"body":"Alright, I'm by no means done, but I thought I'd give you a chance to weigh in earlier, rather than later.\r\n\r\n**Changes**\r\n - `INotify` is no longer cloneable. Therefore the API is essentially single-threaded, enforced by ownership semantics.\r\n - A new method `closer()` is introduced. Its return value enables asynchronous closing of the inotify fd.\r\n   - To avoid any races, the actual closing is still done by whoever owns the corresponding `INotify`.\r\n   - This only happens when `wait_for_events()` is called.\r\n   - To allow `wait_for_events()` to react to asynchronous closing, it spins in an epoll loop with a smallish timeout.\r\n\r\n**TODO**\r\n - [ ] Look at `available_events()` wrt asynchronous closing. Currently it does not make sense, because the caller can't determine if the inotify fd was closed without calling a blocking method. Maybe expose the state?\r\n - [ ] Figure out a good epoll timeout (10ms seems a bit high).\r\n - [x] Go over all the `unwrap()` calls and figure out how to deal with the potential error conditions.\r\n - [ ] More tests\r\n - [ ] Documentation\r\n\r\n(ref #28)"},"comment":{"url":"https://api.github.com/repos/hannobraun/inotify-rs/issues/comments/153475430","html_url":"https://github.com/hannobraun/inotify-rs/pull/29#issuecomment-153475430","issue_url":"https://api.github.com/repos/hannobraun/inotify-rs/issues/29","id":153475430,"user":{"login":"hannobraun","id":85732,"avatar_url":"https://avatars.githubusercontent.com/u/85732?v=3","gravatar_id":"","url":"https://api.github.com/users/hannobraun","html_url":"https://github.com/hannobraun","followers_url":"https://api.github.com/users/hannobraun/followers","following_url":"https://api.github.com/users/hannobraun/following{/other_user}","gists_url":"https://api.github.com/users/hannobraun/gists{/gist_id}","starred_url":"https://api.github.com/users/hannobraun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannobraun/subscriptions","organizations_url":"https://api.github.com/users/hannobraun/orgs","repos_url":"https://api.github.com/users/hannobraun/repos","events_url":"https://api.github.com/users/hannobraun/events{/privacy}","received_events_url":"https://api.github.com/users/hannobraun/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T20:20:42Z","updated_at":"2015-11-03T20:20:42Z","body":":)"}}