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.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,136c120daac2a1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 30 Jan 2006 20:58:38 -0600 From: "Steve" Newsgroups: comp.lang.ada References: <1138659171.491931.322480@g49g2000cwa.googlegroups.com> Subject: Re: tasksing and TCP sockets Date: Mon, 30 Jan 2006 19:02:12 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-7cBqyVd53wuBG6JTF1uAUIuYcMagJaRMR1vFT+R0YseJ9D/dHVu0Piw876P6IFUueGHcVUckRhWp5oF!HHrfqPbVuauAQUCOvISd6ifV8tpHYFq1ZT37OqUg5M/Uu6B7INSuD0o+YqMZiJQcJvKpPtEzxamI!Siv9ImVzBf7Nrg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:2721 Date: 2006-01-30T19:02:12-08:00 List-Id: "Rolf" wrote in message news:1138659171.491931.322480@g49g2000cwa.googlegroups.com... [snip] >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 � 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 Your approach sounds reasonable to me. I wrote my own wrappers for Win32 sockets API before GNAT.Sockets was born, so I can't say much about their behavior... but, using the Win32 API, I have been able to have one task reading a socket and another task writing the same socket using blocking TCP/IP sockets with no issues of reads causing writes to block or vise-versa. I have seen the type of problem you describe with serial I/O on windows. With serial I/O you have to open the device file with an OVERLAPPED attirbute or one task pending on a read will cause a write to block As I mentioned earlier, I'm not familiar with the GNAT.Sockets implementation so it is entirely possible that you are seeing the same behavior because of the socket implementation. Steve (The Duck)