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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a6c65cbc407987fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-14 10:37:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DD3ED6C.80909@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: dynamic multithreading References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 14 Nov 2002 18:37:47 GMT NNTP-Posting-Host: 63.184.16.81 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1037299067 63.184.16.81 (Thu, 14 Nov 2002 10:37:47 PST) NNTP-Posting-Date: Thu, 14 Nov 2002 10:37:47 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30893 Date: 2002-11-14T18:37:47+00:00 List-Id: Artiom Ivanov wrote: > As you know in many applications when using threads, we sometimes need to > create a "tasks" dynamically (I mean at run-time). Ada has 2 ways to dynamically create tasks: 1. Declare tasks locally declare T : Some_Task_Type; begin ... end; -- execution will not reach here until T finishes. If necessary, the task definition can also be local. Subprograms may declare task objects which are local to the subprogram; the subprogram will not return until its local tasks finish. 2. Use access to task values task type Whatever is ... type Whatever_Ptr is access Whatever; T : Whatever_Ptr; ... T := new Whatever; The scope in which the access type is declared will not be left until all tasks created using new have finished. The access values can be passed around, assigned, returned from functions, and so on. -- Jeff Carter "I spun around, and there I was, face to face with a six-year-old kid. Well, I just threw my guns down and walked away. Little bastard shot me in the ass." Blazing Saddles