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 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail From: "Rolf" Newsgroups: comp.lang.ada Subject: Re: tasksing and TCP sockets Date: 3 Feb 2006 12:33:03 -0800 Organization: http://groups.google.com Message-ID: <1138998783.941745.74440@g14g2000cwa.googlegroups.com> References: <1138748598.084128.58760@o13g2000cwo.googlegroups.com> <1138779556.310888.211970@g47g2000cwa.googlegroups.com> NNTP-Posting-Host: 84.152.19.79 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1138998788 10811 127.0.0.1 (3 Feb 2006 20:33:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 3 Feb 2006 20:33:08 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=84.152.19.79; posting-account=X6JcNAwAAACCYFUClJvh1OjD0lgttvkm Xref: g2news1.google.com comp.lang.ada:2765 Date: 2006-02-03T12:33:03-08:00 List-Id: Stephen Leake wrote: > "Rolf" writes: > > > The main program essentially looks like this: > > > > loop > > Read_Sens; > > > > Behave; > > > > delay until Next; > > Next := Next + Period; -- Period == 0.1 sec typ. > > end loop; > > Ok. So Read_Sens runs the h/w abstraction layer, Behave is the > application layer. More or less. Behave also calls a write routine in the abstraction layer. > > The world simulation program at the other end of the TCP socket does > > not know about the internal timing of the application (perhaps I should > > add a synchronization protocol, now that I think of it) > > I'm still not clear where the sockets are. I think Read_Sens reads > from a socket to get the simulated sensor values. Does it try to read > data for all variables from the socket _every_ time it is called? Or > does it check to see if some new data is available? Read_Sens reads the hardware sensors in the non-simulated case and writes them to global variables. It reads them from a protected object when communicating via TCP. The second task (besides the main program) continuously reads from the socket and writes to the protected object. That second task and the protected object do not exist in the non-simulated case. > Behave writes to a socket for user display? and it changes the world in the world simulation. The world simulation also has a GUI. > Then the question is what drives the simulation; does it wait for > Read_Sens to read data, or just run at some rate? Does the simulation > react to anything Behave does? > > Yes, you need synchronization between the simulation and Read_Sens, > and possibly Behave. That is probably the root cause of your problem. that is certainly true and I have to think about it again. No, the root cause of my problem was a buggy socket implementation in gcc-3.4.4 (at least I think so). I recompiled my program with GNAT GPL 2005 and it worked without any other modification