Blob
- Date:
- Message:
- In non-blocking recv functions in libmux and libdraw, distinguish between "cannot receive without blocking" and "EOF on connection". In libmux, do not elect async guys muxers, so that synchronous RPC calls run in the main event loop (e.g., in eresized) do not get stuck. Fixes problem reported by Lu Xuxiao, namely that jpg etc. would spin at 100% cpu usage.
- Actions:
- History | Blame | Raw File
1 #ifndef _MUX_H_2 #define _MUX_H_ 13 #if defined(__cplusplus)4 extern "C" {5 #endif7 AUTOLIB(mux)9 typedef struct Mux Mux;10 typedef struct Muxrpc Muxrpc;11 typedef struct Muxqueue Muxqueue;13 struct Muxrpc14 {15 Mux *mux;16 Muxrpc *next;17 Muxrpc *prev;18 Rendez r;19 uint tag;20 void *p;21 int waiting;22 int async;23 };25 struct Mux26 {27 uint mintag; /* to be filled by client */28 uint maxtag;29 int (*send)(Mux*, void*);30 void *(*recv)(Mux*);31 int (*nbrecv)(Mux*, void**);32 int (*gettag)(Mux*, void*);33 int (*settag)(Mux*, void*, uint);34 void *aux; /* for private use by client */36 /* private */37 QLock lk; /* must be first for muxinit */38 QLock inlk;39 QLock outlk;40 Rendez tagrend;41 Rendez rpcfork;42 Muxqueue *readq;43 Muxqueue *writeq;44 uint nwait;45 uint mwait;46 uint freetag;47 Muxrpc **wait;48 Muxrpc *muxer;49 Muxrpc sleep;50 };52 void muxinit(Mux*);53 void* muxrpc(Mux*, void*);54 void muxprocs(Mux*);55 Muxrpc* muxrpcstart(Mux*, void*);56 int muxrpccanfinish(Muxrpc*, void**);58 /* private */59 int _muxsend(Mux*, void*);60 int _muxrecv(Mux*, int, void**);61 void _muxsendproc(void*);62 void _muxrecvproc(void*);63 Muxqueue *_muxqalloc(void);64 int _muxqsend(Muxqueue*, void*);65 void *_muxqrecv(Muxqueue*);66 void _muxqhangup(Muxqueue*);67 int _muxnbqrecv(Muxqueue*, void**);69 #if defined(__cplusplus)70 }71 #endif72 #endif