From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] locking From: "Russ Cox" Date: Wed, 18 Apr 2007 12:35:42 -0400 In-Reply-To: <93f386afe6d3798ebd79035d9675a65d@quintile.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20070418163542.D1D3B1E8C3A@holo.morphisms.net> Topicbox-Message-UUID: 4c0a9ce6-ead2-11e9-9d60-3106f5b1d025 > 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