> I want to run this multithreaded, but the requests > and replies are not atomic on the same file descriptor. > Thus I need to have each thread request on its own file > descriptor, or, have a Qlock in the requesting program > to interlock requests and replies.
does the synethetic file protocol have request ids so that it can allow multiple outstanding requests and can send replies out-of-order? if so, then you need only multiplex the requests onto the synthetic file. see libmux in the p9p distribution for a simple encapsulation of the relevant logic. if not, then you really need one fd per active request. you could use a cache of already-opened fds; that would only grow to the number of active requests, not the number of threads. russ
