{"action":"reopened","issue":{"url":"https://api.github.com/repos/ocsigen/lwt/issues/133","labels_url":"https://api.github.com/repos/ocsigen/lwt/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/ocsigen/lwt/issues/133/comments","events_url":"https://api.github.com/repos/ocsigen/lwt/issues/133/events","html_url":"https://github.com/ocsigen/lwt/issues/133","id":60675920,"number":133,"title":"Documentation of Lwt_unix.write appears to be misleading.","user":{"login":"haesbaert","id":204048,"avatar_url":"https://avatars.githubusercontent.com/u/204048?v=3","gravatar_id":"","url":"https://api.github.com/users/haesbaert","html_url":"https://github.com/haesbaert","followers_url":"https://api.github.com/users/haesbaert/followers","following_url":"https://api.github.com/users/haesbaert/following{/other_user}","gists_url":"https://api.github.com/users/haesbaert/gists{/gist_id}","starred_url":"https://api.github.com/users/haesbaert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haesbaert/subscriptions","organizations_url":"https://api.github.com/users/haesbaert/orgs","repos_url":"https://api.github.com/users/haesbaert/repos","events_url":"https://api.github.com/users/haesbaert/events{/privacy}","received_events_url":"https://api.github.com/users/haesbaert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-11T15:25:24Z","updated_at":"2015-03-31T16:29:57Z","closed_at":null,"body":"From lwt_unix.mli:\r\n\"write fd buf ofs len has the same semantic as Unix.write, but is cooperative\"\r\n\r\nunless I read the code wrong, there is one key difference with Lwt_unix.write regarding write on blocked fds. The Unix.write _never_ returns a shortcount, since it actually loops calling multiple reads, for the syscall semantic, there is Unix.write_single.\r\n\r\nThe Lwt_unix.write may return a short count on a blocked fd, this is a key difference if before (with the Unix.write mindset), you were never expecting short counts.\r\n\r\nThese are the differences I found\r\nUNBLOCKING:\r\n  Unix.write -> May return short count.\r\n\t      May return EAGAIN.\r\n  Lwt_unix.write -> May return a short count.\r\n\t       \t  Never returns EAGAIN.\r\nBLOCKING:\r\n  Unix.write -> Never returns a short count.\r\n\t      discards bytes written in case of an error\r\n\t      in a second write and returns the error.\r\n  Lwt_unix.write -> May return a short count.\r\n\t       \t  Correctly returns the error.\r\n(not considering EAGAIN on the BLOCKING case since it is not allowed)\r\n\r\nI'm new to ocaml, so forgive me if I understood something wrong."}}