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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: assigning priority to task Date: Wed, 24 Sep 2014 16:55:02 +0200 Organization: A noiseless patient Spider Message-ID: References: <00ba137c-cc71-4f7f-8c39-740c6981c992@googlegroups.com> <47d6f1fc-1cf1-4542-a6e2-233b758aefec@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 24 Sep 2014 14:54:20 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="23e59b4906029a0ce22afc4c4b1f25ee"; logging-data="1235"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cEZpNYM72cil0XeOoWt9v" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.7.0 In-Reply-To: <47d6f1fc-1cf1-4542-a6e2-233b758aefec@googlegroups.com> Cancel-Lock: sha1:+rZLz0m+MyR+WUCwJhMnrpDkEIY= Xref: number.nntp.dca.giganews.com comp.lang.ada:189137 Date: 2014-09-24T16:55:02+02:00 List-Id: On 2014-09-24 15:17, Stribor40 wrote: > how is calling another task at the entry point different from main thread calling another function or procedure and passing parameters to those? sorry if question is dumb but I am just failing to see the difference.... > Is it because of tasks synchronization mechanism that calling tasks waits if another tasks is using things defined after accept statement? > (Not compiled code) task T is entry T1; entry T2; end T task body T is begin loop select accept T1 do Put_Line ("rendez-vouz start"); Put_Line ("Do_stuff that holds caller"); Put_Line ("rendez-vouz stop"); done or accept T1 do Put_Line ("rendez-vouz start"); Put_Line ("rendez-vouz stop"); done -- parallel execution from here Put_Line ("Do_stuff that DOES NOT hold caller"); -- to here or terminate; end select; end loop; end T if main calls T.T1, the difference compared with calling a procedure T1 in package T is that the work is performed in another thread and main waits until complete. You do not get parallel execution. You serialize work, but could use a protected object instead however, if main calls T.T2, the difference compared with calling a procedure T2 in package T is that the work is performed in another thread and main is released right away, so the T2 work is carried out while main continues. You get _parallel_ execution. -- Björn