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,e7eb1c5f294e17be X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-30 18:35:17 PST Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!news2.near.net!news.delphi.com!usenet From: tmoran@bix.com Newsgroups: comp.lang.ada Subject: Re: Assignment of limited private types... Date: 31 Jan 1995 02:35:17 GMT Organization: Delphi Internet Services Corporation Message-ID: <3gk7l5$6r8@news1.delphi.com> NNTP-Posting-Host: bix.com Date: 1995-01-31T02:35:17+00:00 List-Id: stevem@dcs.gla.ac.uk (Steve McGowan) wrote: > > I'd like to pass in a 'file_type' identifier into a task, make a local > copy of this identifier within the task, and then write text to this > file stream inside the task. If you did make local copies, what behavior would you expect when two different tasks, using two copies of the file handle, simultaneously wrote to the file? If you don't really want multiple copies of the file handle, how about passing in the file name and letting the task open the file locally, instead of passing in the file handle. If you do want multiple tasks to write to the file, but don't want the bits randomly intermingled, you need to synchronize your tasks. In that case, how about having a third task do all the IO on the file, using Accepts to accept (one at a time) requests for IO from the other tasks. In general, Ada rules are not arbitrary, and not there for the convenience of the compiler writer, or to make your life hard. If you can't do something straightforwardly in Ada, it's usually productive to think twice about whether the approach you're taking is really the best one.