Introducing libuv
libuv’s C API provides a lot of functions. In many ways it serves as a replacement for much of the standard library of a traditional UNIX operating system, so that’s not too surprising. What’s fascinating, though, is how few basic concepts libuv relies upon to provide a consistent programming model over a wide variety of different I/O scenarios: clients and server, sockets and pipes, TCP and UDP. There are three fundamental building blocks to libuv:
- The event loop
- Handles
- Callbacks
They fit together like so: pipes and the like are represented as handles, and registered onto the event loop. The event loop is responsible for monitoring each handle. When an event occurs, a user-specified callback function is invoked with the data ...
Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.