An introduction to libuv (2016)

By eatonphil - 12 hours ago

Showing first level comment(s)

We merged this guide into which got some updates to match API changes.

saghul - 10 minutes ago

I work with Nikhil. He's incredibly smart and a fantastic programmer. Didn't know he wrote a book on libuv though!

nosefrog - 6 hours ago

> This book and the code is based on libuv version v1.3.0.

libuv v1.30 was release at on Jan 28, 2015. It is at v1.22.0.

tapirl - 9 hours ago

libuv supports child processes via fork, such as in uv_spawn. It also uses multiple threads to support uv_fs_stat, etc.

How does it handle the well known incompatibility between fork and threads?

ridiculous_fish - 10 hours ago

Why is the hello world example [0] unnecessarily allocating and freeing the uv_loop_t? When I see this kind of crap right out of the gate I immediately begin suspecting this is probably a pile of awful code written by a novice C programmer then documented and published as if it's the best thing since sliced bread.

Much of the value in making a struct (and hence its size) public and supplying a pointer to the initializer is the potential to embed or avoid heap allocation of the thing altogether, and here in an example which would benefit from both the simplified code in addition to demonstrating the advantage, it's completely missed.

Fixed form:

  int main() {
    uv_loop_t loop;

    printf("Now quitting.\n");
    uv_run(&loop, UV_RUN_DEFAULT);


    return 0;

newnewpdro - 8 hours ago