{"issue":{"created_at":"2011-11-28T11:03:26Z","state":"open","updated_at":"2011-12-13T00:34:10Z","comments":8,"user":{"gravatar_id":"736f7550d45b8462ab2a4aedd8c27e94","id":1057638,"url":"https://api.github.com/users/rmtew","avatar_url":"https://secure.gravatar.com/avatar/736f7550d45b8462ab2a4aedd8c27e94?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"rmtew"},"body":"Currently the control flow for the libuv framework is (as I understand it):\r\n\r\n  ... set up application ...\r\n  uv_run()\r\n  ... return from blocking indefinitely ...\r\n\r\nThis  means that if an application is to use libuv, it needs to let libuv drive it.  This affects the way in which the application can be written.  If there was a minimal change to the libuv running mechanism to let it be pumped with a specified timeout, then an application could instead drive libuv more in the manner of a library and a main loop could be written in a straight-forward and synchronous manner.\r\n\r\nI suggest that this could be done with the following changes:\r\n1. The contents of the while loop in UV_RUN are moved to UV_PUMP.\r\n2. A uv_pump() method is added that takes a optional timeout parameter.\r\n3. The poll method observes the timeout parameter instead of the result of uv_get_poll_timeout(), or perhaps gets it from that function for this pending one-off iteration.\r\n\r\nI can write and provide a patch, if there is an indication that one would be applied.\r\n\r\nCheers.","assignee":null,"id":2366191,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[{"name":"API","color":"e10c02","url":"https://api.github.com/repos/joyent/libuv/labels/API"}],"number":262,"title":"Add asynchronous interface for libuv itself","html_url":"https://github.com/joyent/libuv/issues/262","closed_at":null,"url":"https://api.github.com/repos/joyent/libuv/issues/262","milestone":null},"action":"created","comment":{"created_at":"2011-12-13T00:34:09Z","updated_at":"2011-12-13T00:34:09Z","user":{"gravatar_id":"3d43d9038ab645ecb2e3a1df2951d30a","id":275871,"url":"https://api.github.com/users/bnoordhuis","avatar_url":"https://secure.gravatar.com/avatar/3d43d9038ab645ecb2e3a1df2951d30a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"bnoordhuis"},"body":"Oh, I see what you mean. Like I said, the name is inconsequential - if the Windows component of libuv already defines a `uv_poll()`, we'll name it `uv_run_once()`.","id":3116829,"url":"https://api.github.com/repos/joyent/libuv/issues/comments/3116829"}}