[HN Gopher] C-events, yet another event loop, simpler, smaller, ...
       ___________________________________________________________________
        
       C-events, yet another event loop, simpler, smaller, faster, safer
        
       Author : thetechstech
       Score  : 50 points
       Date   : 2025-12-26 14:06 UTC (6 days ago)
        
 (HTM) web link (zelang-dev.github.io)
 (TXT) w3m dump (zelang-dev.github.io)
        
       | mgaunard wrote:
       | Why not io_uring? That's the biggest game changer.
       | 
       | I guess because it's not possible to abstract away as much.
        
         | immibis wrote:
         | io_uring works fundamentally differently from polling loops and
         | closer to Windows' IOCP (which is awesome and better than
         | everything that existed on Linux for many years). With a
         | polling loop you wait for data to be available in buffers, and
         | then once you get the ready event, you copy it from the
         | kernel's buffer to yours. With IOCP or io_uring, you submit a
         | long-running read or write event directly into your buffer. You
         | get the event after the read or write call, instead of before.
         | Because of this, it's not possible to make it a drop-in
         | replacement for poll/epoll.
        
           | pengaru wrote:
           | didn't prevent libuv from adding support for it when
           | available:
           | 
           | https://github.com/libuv/libuv/issues/1947
        
             | manwe150 wrote:
             | libuv is more nearly designed for adding IOCP-like support
             | to epoll systems than epoll to IOCP (though it can
             | approximate either direction), so adding io_uring was
             | already straightforward, by design
             | 
             | Aside: the wepoll mentioned in this repo is a standalone
             | project extracted libuv, for projects that only desire to
             | support Berkeley sockets and don't care about other events
             | sources (processes or pipes)
        
         | foobarian wrote:
         | Is this a Windows lib? The tradeoffs are probably completely
         | different than what we're used to then.
         | 
         | > c-events provides function wrappers to some Linux like
         | functionality, exp. mkfifo for Windows.
        
       | kevin_thibedeau wrote:
       | void *rwtask(param_t v) {        ...        a = v->int_ptr;
       | ...        free(a);
       | 
       | It seems architecturally unwise to have a callback responsible
       | for freeing its parameters. At the very least this fossilizes
       | dependency on the stdlib heap.
        
       | emersion wrote:
       | My go-to small event loop library is https://github.com/any1/aml
        
       ___________________________________________________________________
       (page generated 2026-01-01 23:00 UTC)