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.8 required=5.0 tests=BAYES_00,URI_HEX autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b3258fa06e2efdf3,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-01 07:01:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!212.97.175.23!not-for-mail From: Jano Newsgroups: comp.lang.ada Subject: Tasks unleashed Date: Thu, 1 May 2003 16:01:48 +0200 Message-ID: NNTP-Posting-Host: 212.97.175.23 X-Trace: fu-berlin.de 1051797686 13542128 212.97.175.23 (16 [49872]) X-Newsreader: MicroPlanet Gravity v2.50 Xref: archiver1.google.com comp.lang.ada:36806 Date: 2003-05-01T16:01:48+02:00 List-Id: Hello again, now my question is referred to the use of task types through access types. I seem to remember from a distant conversation that every task allocated takes a small amount of memory, amongst other things, to provide satisfactory results for 'Callable attribute. Sometimes I'd like to have a task type that, when some activity is needed, is created and forgotten. For example, it takes an access constraint and from that point on is completely independent. A related aspect is that I don't know if Unchecked_deallocation is to be performed on tasks. See the following example: ------8<--------- with Ada.Unchecked_deallocation; procedure test is task type tt is entry The_end; end tt; task body tt is begin accept The_end do null; end The_end; -- delay 1.0; end tt; type att is access all tt; x : att; procedure Free is new Ada.Unchecked_deallocation (tt, att); begin loop -- for N in 1 .. 100 loop x := new tt; x.The_end; Free (x); end loop; end; ------8<--------- It illustrates various points that come to my mind: *) It eats quickly all my memory (Gnat 3.15p) *) You can't be sure that the task is terminated when free is tried (and no exception is raised in that case). *) Free seems to do nothing (gnatmem reports 0 deallocations using a closed loop of 100 iterations). In any case, the memory thing forces to use pools of reusable tasks, it's my main and crucial conclusion. Even if Free for tasks were not to free resources, it seems reasonable that it could instruct the runtime that that task will not be referenced again, so it should leave a 0 memory footprint after termination? But now I'm making things up, I can't find right now specific comments in the ARM about task access types. Could someone comment on these things? Behave differently other compilers? I'm a fool to try these things or simply an ignorant? I should say that I have an innate instinct to try to resolve things the way others see distinctly are not to be tried :) Now that there is an ongoing discussion about people not knowing Ada using it for large new developments, think about it: I have some fair experience, several years of exposure (but only one fairly sized project behind me), and I'm still trying these twisted things. What could do a complete ignorant :) My other glorious idea yesterday was to free a protected type from inside one of its own procedures. I did it, but decided not to carry on (nothing seemed immediately wrong, though)... What things could arise from that? -- ------------------------- Jano 402450.at.cepsz.unizar.es -------------------------