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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d69420c8e0f39b97 X-Google-Attributes: gid103376,public From: john schneider Subject: Re: Tasking newbee Date: 1997/04/01 Message-ID: <33415AA9.41C67EA6@ti.com>#1/1 X-Deja-AN: 229930193 References: <33412898.2A8C@INnet.be> Newsgroups: comp.lang.ada Date: 1997-04-01T00:00:00+00:00 List-Id: Sebastien Pochic wrote: [snip] > task body First_Task is > begin > loop > select > accept Hello do > for i in 1..1000000 loop > null; > end loop; > put("Hello! I'm task #1"); > new_line; > end Hello; > or > accept Hi do > put("Hi, I'm task #1"); > new_line; > end Hi; > end select; > end loop; > end First_Task; > [snip] The structure of entry points REQUIRES just what it is that you are asking to avoid. Re-read your textbooks/LRM regarding the behavior of tasks and rendesvous. Any code within the entry (between do... and ...end) MUST BE completed before either the caller or "acceptor" can continue, so the loop has to be allowed to count before your main routine ever gets a chance to make the other calls. Try structuring your task(s) like this: task body First_Task is begin loop select accept Hello; for i in 1..1000000 loop null; end loop; put("Hello! I'm task #1"); new_line; or accept Hi; put("Hi, I'm task #1"); new_line; or -- It's amazing how long a program terminate; -- can continue to run without this!! end select; end loop; end First_Task; Of course, this might not accomplish what you want, either, because all of your tasks are running at the same priority and the rules don't require the run-time to make any fancy choices between tasks eligible to run at the same priority. Again -- head for the LRM. One last warning -- Depending on your compiler, using multiple tasks to perform serial output to the same file (especially to the console screen) may have less-than-predictable results. Now that I've given you more problems than answers ... enjoy the rest of your day. John Schneider j-schneider@ti.com The opinions are mine, but you are welcome to share them.