Ignore:
Timestamp:
Jun 8, 2022, 7:07:51 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
bbf61838
Parents:
6e2b04e
Message:

First draft at acceptor thread webserver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/worker.hfa

    r6e2b04e r7f0ac12  
    11#pragma once
    22
     3#include <iofwd.hfa>
     4#include <queueLockFree.hfa>
    35#include <thread.hfa>
    46
     
    2628};
    2729
    28 thread Worker {
     30void ?{}( sendfile_stats_t & this );
     31
     32struct connection {
    2933        int pipe[2];
     34        struct {
     35                sendfile_stats_t sendfile;
     36        } stats;
     37};
     38
     39static inline void ?{}( connection & this ) {
     40        this.pipe[0] = -1;
     41        this.pipe[1] = -1;
     42}
     43
     44thread AcceptWorker {
     45        connection conn;
    3046        int sockfd;
    3147        struct sockaddr * addr;
     
    3349        int flags;
    3450        volatile bool done;
     51};
     52void ?{}( AcceptWorker & this);
     53void main( AcceptWorker & );
     54
     55
     56struct PendingRead {
     57        PendingRead * volatile next;
     58        io_future_t f;
    3559        struct {
    36                 sendfile_stats_t sendfile;
    37         } stats;
     60                void * buf;
     61                size_t len;
     62        } in;
     63        struct {
     64                volatile int fd;
     65        } out;
    3866};
    39 void ?{}( Worker & this);
    40 void main( Worker & );
     67
     68static inline PendingRead * volatile & ?`next ( PendingRead * node ) {
     69        return node->next;
     70}
     71
     72thread ChannelWorker {
     73        connection conn;
     74        volatile bool done;
     75        mpsc_queue(PendingRead) * queue;
     76};
     77void ?{}( ChannelWorker & );
     78void main( ChannelWorker & );
     79
     80thread Acceptor {
     81        mpsc_queue(PendingRead) * queue;
     82        int sockfd;
     83        struct sockaddr * addr;
     84        socklen_t * addrlen;
     85        int flags;
     86        volatile bool done;
     87};
     88void ?{}( Acceptor & );
     89void main( Acceptor & );
Note: See TracChangeset for help on using the changeset viewer.