[commit: ghc] ghc-7.10: Event Manager: Make one-shot a per-registration property (7bf4793)

git at git.haskell.org git at git.haskell.org
Fri Jan 30 08:58:55 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/7bf4793b76080de15937b30b5bee5f62cc23d176/ghc

>---------------------------------------------------------------

commit 7bf4793b76080de15937b30b5bee5f62cc23d176
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Jan 12 18:36:23 2015 -0500

    Event Manager: Make one-shot a per-registration property
    
    Currently the event manager has a global flag for whether to create
    epoll-like notifications as one-shot (e.g. EPOLLONESHOT, where an fd
    will be deactivated after its first event) or standard multi-shot
    notifications.
    
    Unfortunately this means that the event manager may export either
    one-shot or multi-shot semantics to the user. Even worse, the user has
    no way of knowing which semantics are being delivered. This resulted in
    breakage in the usb[1] library which deadlocks after notifications on
    its fd are disabled after the first event is delivered.  This patch
    reworks one-shot event support to allow the user to choose whether
    one-shot or multi-shot semantics are desired on a per-registration
    basis. The event manager can then decide whether to use a one-shot or
    multi-shot epoll.
    
    A registration is now defined by a set of Events (as before) as well as
    a Lifetime (either one-shot or multi-shot). We lend monoidal structure
    to Lifetime choosing OneShot as the identity. This allows us to combine
    Lifetime/Event pairs of an fd to give the longest desired lifetime of
    the registration and the full set of Events for which we want
    notification.
    
     [1] https://github.com/basvandijk/usb/issues/7
    
    (cherry picked from commit 023439980f6ef6ec051f676279ed2be5f031efe6)


>---------------------------------------------------------------

7bf4793b76080de15937b30b5bee5f62cc23d176
 libraries/base/GHC/Event.hs          |   1 -
 libraries/base/GHC/Event/IntTable.hs |   4 +
 libraries/base/GHC/Event/Internal.hs |  48 ++++++++
 libraries/base/GHC/Event/Manager.hs  | 224 +++++++++++++++++++----------------
 libraries/base/GHC/Event/Thread.hs   |   6 +-
 5 files changed, 175 insertions(+), 108 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7bf4793b76080de15937b30b5bee5f62cc23d176


More information about the ghc-commits mailing list