Skip to content
SocketPollItem

SocketPollItem

Description

One slot in a SocketPoll call. Caller fills fd (from a Listener or Socket) and events_requested; SocketPoll writes events_ready back.

Usage example (Cross-references)

Usage examples (Cross-references)
    // ---------------------------------------------------------------------------
    
    i32 SocketPoll(SocketPollItem *items, u32 count, i32 timeout_ms) {
        if (!items && count > 0) {
            LOG_ERROR("SocketPoll: items is NULL but count > 0");
        u32 events_requested;
        u32 events_ready;
    } SocketPollItem;
    
    // --- Addressing -------------------------------------------------------------
    /// TAGS: Socket, Poll, Multiplexing
    ///
    i32 SocketPoll(SocketPollItem *items, u32 count, i32 timeout_ms);
    
    #endif // MISRA_SYS_SOCKET_H
        }
    
        SocketPollItem items[2];
        char           buf[8192];
        while (!g_stop) {
        char           buf[8192];
        while (!g_stop) {
            items[0] = (SocketPollItem) {.fd = a->fd, .events_requested = SOCKET_POLL_READ};
            items[1] = (SocketPollItem) {.fd = b->fd, .events_requested = SOCKET_POLL_READ};
        while (!g_stop) {
            items[0] = (SocketPollItem) {.fd = a->fd, .events_requested = SOCKET_POLL_READ};
            items[1] = (SocketPollItem) {.fd = b->fd, .events_requested = SOCKET_POLL_READ};
    
            i32 ready = SocketPoll(items, 2, 1000);
                // accept() blocking forever (and without the EINTR error
                // log noise when it does).
                SocketPollItem listen_item = {.fd = listener.fd, .events_requested = SOCKET_POLL_READ};
                i32            ready       = SocketPoll(&listen_item, 1, 1000);
                if (ready <= 0) {
Last updated on