1. 29 Nov, 2015 4 commits
    • Damien George's avatar
    • Paul Sokolovsky's avatar
    • Paul Sokolovsky's avatar
      unix/modtime: sleep(): Automatically restart after receiving EINTR. · 0bb57bf5
      Paul Sokolovsky authored
      THis is required to deal well with signals, signals being the closest
      analogue of hardware interrupts for POSIX. This is also CPython 3.5
      compliant behavior (PEP 475).
      The main problem implementing this is to figure out how much time was
      spent in waiting so far/how much is remaining. It's well-known fact that
      Linux updates select()'s timeout value when returning with EINTR to the
      remaining wait time. Here's what POSIX-based standards say about this:
      "Upon successful completion, the select() function may modify the object
      pointed to by the timeout argument."
      I.e. it allows to modify timeout value, but doesn't say how exactly it is
      modified. And actually, it allows such modification only "upon successful
      completion", which returning with EINTR error hardly is.
      POSIX also allows to request automatic EINTR restart for system calls using
      sigaction call with SA_RESTART flag, but here's what the same document says
      about it:
      "If SA_RESTART has been set for the interrupting signal, it is
      implementation-defined whether the function restarts or returns with
      In other words, POSIX doesn't leave room for both portable and efficient
      handling of this matter, so the code just allows to manually select
      Linux-compatible behavior with MICROPY_SELECT_REMAINING_TIME option,
      or otherwise will just raise OSError. When systems with non-Linux behavior
      are found, they can be handled separately.
    • Paul Sokolovsky's avatar
  2. 28 Nov, 2015 2 commits
  3. 27 Nov, 2015 3 commits
  4. 26 Nov, 2015 5 commits
  5. 25 Nov, 2015 5 commits
  6. 24 Nov, 2015 16 commits
  7. 23 Nov, 2015 5 commits