1. 08 Jan, 2018 1 commit
    • Marek Vavruša's avatar
      Implement worker coroutines for asynchronous background processing · 8fa95978
      Marek Vavruša authored
      This implements worker coroutines in Lua to perform non-blocking I/O and do many things concurrently.
      For example a file watcher can be now implemented as:
        local watcher = notify.opendir('/etc')
        -- Watch changes to /etc/hosts
        worker.coroutine(function ()
          for flags, name in watcher:changes() do
            for flag in notify.flags(flags) do
              print(name, notify[flag])
      In order to make this work, the runtime uses the cqueues library which
      can run coroutines concurrently, and return a file descriptor to poll on
      if it's blocked. The worker takes that file descriptor and calls
      `event.socket(pollfd, resume_callback)` so that libuv can wake up
      the worker when its ready again.
      The cqueues library is still optional, but if it's not present following stuff
      won't work:
      * worker.coroutine()
      * worker.sleep()
  2. 24 Nov, 2017 1 commit
  3. 25 Aug, 2016 1 commit
  4. 06 Jul, 2016 9 commits