From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,2afbf99c1f65cbe,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.85.37 with SMTP id e5mr1501519paz.31.1344322761057; Mon, 06 Aug 2012 23:59:21 -0700 (PDT) Path: g9ni2980161pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!news.nctu.edu.tw!csnews.cs.nctu.edu.tw!news.cs.nctu.edu.tw!feeder.erje.net!newsfeed.straub-nv.de!reality.xs3.de!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Sharing a socket connection Date: Tue, 31 Jul 2012 10:56:21 +0200 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: <87hasofgwa.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: monowall.adaheads.com Mime-Version: 1.0 X-Trace: munin.nbi.dk 1343724982 31791 77.234.168.91 (31 Jul 2012 08:56:22 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 31 Jul 2012 08:56:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:hgqfGMrOlST/PhvCUPRuGB6amYs= Content-Type: text/plain; charset=us-ascii Date: 2012-07-31T10:56:21+02:00 List-Id: We are working on a system where a number of Ada tasks are going to share a single socket connection to a server [1]. The socket connection is bidirectional with requests sent from a client followed by corresponding responses from the server. Each client should only get responses to its own requests. Our current approach is to encapsulate the socket in a package, and use a mutex [2] to lock the socket during an entire send-request-get-response operation. Greetings, Jacob [1] The rationale for this is that the individual tasks only are expected to use the server sporadically, and that letting each task have its own connection may use too many limited resources on the server. [2] Do the standard libraries include a mutex (I have a vague recollection of having seen one, but can't find it), or should we just implement it ourselves (or use the one in "Simple components for Ada"). -- Photo of the day: http://billeder.sparre-andersen.dk/dagens/