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,9bc0262607f781e9,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-07 03:07:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!news.rwth-aachen.de!not-for-mail From: "Alexander Boucke" Newsgroups: comp.lang.ada Subject: Making a package safe for use by multiple tasks Date: Fri, 7 Jun 2002 12:07:39 +0200 Organization: Lehr- und Forschungsgebiet f. Mechanik Message-ID: NNTP-Posting-Host: 134.130.177.114 X-Trace: nets3.rz.RWTH-Aachen.DE 1023444462 2809 134.130.177.114 (7 Jun 2002 10:07:42 GMT) X-Complaints-To: abuse@rwth-aachen.de NNTP-Posting-Date: 7 Jun 2002 10:07:42 GMT X-Newsreader: Microsoft Outlook Express Unix 5.00.2013.1312 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2013.1312 Xref: archiver1.google.com comp.lang.ada:25439 Date: 2002-06-07T10:07:42+00:00 List-Id: Hello! I am just playing with the idea to use multiple tasks in a programm doing linear algebra. The problem lies in my vector-algebra package, that uses some global tmp-object to optimize memory use and reuse. To give you the idea, some not necessarily correct code snippets what this is doing: in the spec: type values is array (<>) or real; type vector is access values; function "+" (left, right : vector) return vector; in the body: tmp_vec : vector; function "+" (left, right : vector) return vector is begin -- test here, if the tmp_vec is of correct size and allocated for i in tmp_vec'range loop tmp_vec(i) := left(i) + right(i); end loop; return tmp_vec; end "+"; I hope this gives you the idea. In fact it is a little more complicated, since I do reference counting on the vectors. The thing with the tmp_vec enables me to reuse this vector several times, e.g. in d := a + b + c it is not necessary to allocate it new every time, I could just overwrite tmp_vec here. This is of course not usable if I use more then one task! And converting the whole thing in some kind of protected type is certainly not very useful, since this would it would not allow parallel execution of vector operations then. Except of getting rid of these tmp_vec things, does anybody of you have an idea, how this could be dealt with. The idea is, that every task needs to have it's own temporary object. But I have no idea how this could be be achieved in an automatic or semi-automatic way. Thanks, Alexander