@hackage select0.2.1
Give the select(2) POSIX function a simple STM interface
Categories
License
BSD-3-Clause
Maintainer
Gard Spreemann <gspreemann@gmail.com>
Links
- Homepage
- Documentation
- No source repository
- Security
Versions
Installation
Dependencies (3)
Dependents (5)
@hackage/libssh2, @hackage/wacom-daemon, @hackage/xbattbar, @hackage/acme-everything, @hackage/udev
While tinkering on a project, I frequently found myself
having to make FFI calls to select(2). This package is an attempt
reduce the boilerplate I needed to do that. While at it, I took the
opportunity to have what select returns put in a TMVar.
The package has three parts:
System.Posix.IO.Select- just wraps
select. Control.Concurrent.STM.TMVarIO- and
Control.Concurrent.MVarIOput the return value of IO actions into aTMVaror anMVar, respectively. Control.Concurrent.STM.RunOrElse- defines functions that give you the return value of whatever finishes first of an IO action and an STM operation.
System.Posix.IO.Select.STM- and
System.Posix.IO.Select.MVardo the above for the special caseselect.
NOTE: I feel I'm occupying prime namespace realestate with a package name like select. I'll happily let myself be chased away if anybody else wants to use this package name. Let me know.
NOTE 2: The vector dependency comes from me not spending time figuring out how to pass lists of data to C without first turning them into vectors. It'll probably disappear soon.
CAVEAT: I'm not an experienced Haskeller (as you can tell from note 2), and this is my first foray into FFI in general. Use with caution.