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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,136c120daac2a1,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail From: "Rolf" Newsgroups: comp.lang.ada Subject: tasksing and TCP sockets Date: 30 Jan 2006 14:12:51 -0800 Organization: http://groups.google.com Message-ID: <1138659171.491931.322480@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: 84.152.67.189 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1138659176 9054 127.0.0.1 (30 Jan 2006 22:12:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 30 Jan 2006 22:12:56 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.51,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=84.152.67.189; posting-account=X6JcNAwAAACCYFUClJvh1OjD0lgttvkm Xref: g2news1.google.com comp.lang.ada:2713 Date: 2006-01-30T14:12:51-08:00 List-Id: Consider an application that communicates with its environment via sensors and actors. For testing purposes the low level access to the sensor and actor data gets replaced by a TCP socket communication whose other end simulates the world, i.e. the world simulation continuously writes sensor data to the socket and accepts commands as actor data. +-----------------------+ | | | application | | | +-----------------------+ | h/w abstraction | | sensors | actors | +-----------------------+ | TCP client | | | TCP server that simulates the world In a stripped down version I can succesfully connect to the server (using GNAT.Sockets) and either read the sensor data *or* write actor data. The program is currently split in two tasks. One tasks contains the application code and the actor communication (using type_id'output(channel)). The second tasks gets started during program initialisation. It reads the data from the socket via type_id'input(channel) and provides the data to the application through a protected object. The problem that I face is that the second task seems to starve the first one. As soon as it is active, the application does not generate debug output anymore. Some background info: gcc-3.4.4 on Windows XP. Java for the world simulation. The simulator sends about 20 packages =E0 11bytes every 100ms. The application sends typically 2-3 packages per second. I have delay statements in both main loops (varied between 0.0 and 0.2 seconds). My questions: - is that a reasonable tasking approach? - I don't know much about sockets (or better I don't remember much). Does a waiting read (in the second task) block a write in the first task? - how can I interrupt the waiting read task to force activity in the main task? - what other hints can you give me? TIA Rolf