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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf4089708c540928,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-17 14:11:49 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-han1.dfn.de!news-koe1.dfn.de!news.rwth-aachen.de!news.uni-stuttgart.de!news.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: I/O dispatching, or custom interrupt handling Date: Sat, 17 Apr 2004 23:11:46 +0200 Message-ID: <877jwe71il.fsf@deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: albireo.enyo.de 1082236307 28126 212.9.189.171 (17 Apr 2004 21:11:47 GMT) Cancel-Lock: sha1:7fg/aF7uYSB5O6ERCuf3yTL5YA0= Xref: archiver1.google.com comp.lang.ada:7277 Date: 2004-04-17T23:11:46+02:00 List-Id: I'm looking for a way to use I/O dispatching (provided by poll(2) or WaitForMultipleObjects()) and task entries together. In some way, this resembles a custom interrupt facility. For example, a gateway which passes data back and forth between a client and a server (over full-duplex connections) could be structured like this: task type Server is entry Client_Activity (Socket : File_Descriptor); entry Server_Activity (Socket : File_Descriptor); entry Statistics (Requests, Clients : out Natural); end Server; task body Server is begin loop select accept Client_Activity (Socket : File_Descriptor) do -- Do something when data from the client arrives. null; end; or accept Server_Activity (Socket : File_Descriptor) do -- Do something when data from the server arrives. null; end; or accept Statistics (Requests, Clients : out Natural) do Requests := 0; Clients :=0; end; end select; end loop; end Server; This example does not include the attach/detach operations which control which file descriptory activity is signaled on which entry. I use a task (and not a protected object) because more than one gateway should run in the same process. If Server only had to wait for file descriptor activity, it would be easy. I'd just call the appropriate system call (probably poll(2)). However, I can't do that if I want to have other entries, too. I wonder how I could implement this efficiently. Obviously, I need some dispatcher task which performs the actual call to poll(2), and protected objects that record pending file descriptor activity (Server might not be able to accept the entry call at once, but the dispatcher task must not block). And I need hand-written wrapper procedures for the Client_Activity and Server_Activity entries because there is no way to refer to these entries directly, using access values or generics. -- Current mail filters: many dial-up/DSL/cable modem hosts, and the following domains: atlas.cz, bigpond.com, postino.it, tiscali.co.uk, tiscali.cz, tiscali.it, voila.fr.