{"action":"created","issue":{"url":"https://api.github.com/repos/sustrik/libmill/issues/158","repository_url":"https://api.github.com/repos/sustrik/libmill","labels_url":"https://api.github.com/repos/sustrik/libmill/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/sustrik/libmill/issues/158/comments","events_url":"https://api.github.com/repos/sustrik/libmill/issues/158/events","html_url":"https://github.com/sustrik/libmill/issues/158","id":169773629,"number":158,"title":"Make regular files switch context","user":{"login":"paulofaria","id":5126193,"avatar_url":"https://avatars.githubusercontent.com/u/5126193?v=3","gravatar_id":"","url":"https://api.github.com/users/paulofaria","html_url":"https://github.com/paulofaria","followers_url":"https://api.github.com/users/paulofaria/followers","following_url":"https://api.github.com/users/paulofaria/following{/other_user}","gists_url":"https://api.github.com/users/paulofaria/gists{/gist_id}","starred_url":"https://api.github.com/users/paulofaria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulofaria/subscriptions","organizations_url":"https://api.github.com/users/paulofaria/orgs","repos_url":"https://api.github.com/users/paulofaria/repos","events_url":"https://api.github.com/users/paulofaria/events{/privacy}","received_events_url":"https://api.github.com/users/paulofaria/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-08-07T00:46:14Z","updated_at":"2016-08-11T06:09:16Z","closed_at":null,"body":"Regular files don't switch context the way they're implemented now. The reason is because regular files ignore [O_NONBLOCK](https://github.com/sustrik/libmill/blob/master/file.c#L54). So they never return [EAGAIN](https://github.com/sustrik/libmill/blob/master/file.c#L112) or [EWOULDBLOCK](https://github.com/sustrik/libmill/blob/master/file.c#L112). So since we can't use O_NONBLOCK, an approach we could take is to create a thread pool, dispatch the work and then when the work is done we deliver the result. We need a way to `fdwait` so for that we can use `eventfd` as it was used for dns resolution in the [past](https://github.com/sustrik/libmill/blob/228001c22b74b78b023231fcb0e24255af915537/ip.c#L259). What do you think about this approach? \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sustrik/libmill/issues/comments/239080803","html_url":"https://github.com/sustrik/libmill/issues/158#issuecomment-239080803","issue_url":"https://api.github.com/repos/sustrik/libmill/issues/158","id":239080803,"user":{"login":"sustrik","id":305718,"avatar_url":"https://avatars.githubusercontent.com/u/305718?v=3","gravatar_id":"","url":"https://api.github.com/users/sustrik","html_url":"https://github.com/sustrik","followers_url":"https://api.github.com/users/sustrik/followers","following_url":"https://api.github.com/users/sustrik/following{/other_user}","gists_url":"https://api.github.com/users/sustrik/gists{/gist_id}","starred_url":"https://api.github.com/users/sustrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sustrik/subscriptions","organizations_url":"https://api.github.com/users/sustrik/orgs","repos_url":"https://api.github.com/users/sustrik/repos","events_url":"https://api.github.com/users/sustrik/events{/privacy}","received_events_url":"https://api.github.com/users/sustrik/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T06:09:16Z","updated_at":"2016-08-11T06:09:16Z","body":"johneh@: It looks like pipe can be made into an actual publicly visible object exported by libmill?"}}
{"actor":{"display_login":"sustrik"}}