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 X-Google-Thread: 103376,9b794838d82ee7c3 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!news.motzarella.org!motzarella.org!not-for-mail From: =?ISO-8859-1?Q?S=E9bastien?= Newsgroups: comp.lang.ada Subject: Re: Task vs Protected Type Date: Fri, 30 May 2008 16:09:56 +0000 Organization: A noiseless patient Spider Message-ID: <484026D4.9040708@gmail.com> References: <1q9sdmclm9qew.15yh93h5qg3l.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: feeder.motzarella.org U2FsdGVkX1+4ssdGUTd9gMB19Roxa3yoBHUZ4XuNTMjyhSFkspKDVJblE4yeXtYN/pMuuIw/YkAO0M67CTjvHVJNY1B0LDPA+tA6JbwIFt/t7Q5CJJG9+D8jH/IdOuf3RKihv0ZZ1aRZmUlcMwgKoQ== X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers NNTP-Posting-Date: Fri, 30 May 2008 16:10:01 +0000 (UTC) In-Reply-To: X-Auth-Sender: U2FsdGVkX1+CjcjHqP1o5AjoDfV0WPhTmEGBaPwzQprO/GBqRT4YEg== Cancel-Lock: sha1:zAkSBqwUEiCpi6UVJnUoqDQvgX4= User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) Xref: g2news1.google.com comp.lang.ada:485 Date: 2008-05-30T16:09:56+00:00 List-Id: > protected type Semaphore_Protected_Type (N : Natural) is > ... > private > Count : Natural := N; > end Semaphore_Protected_Type; I see, using a discriminant type does not require an initialization. I must admit I still have difficulties to think discriminant type while I understand quite well how powerful they are. > Neither. It is a bad idea to use tasks for implementation of low-level > synchronization primitives (like semaphores). Your web application would > probably do much more things than just locking. Instead of Wait, you would > likely have something like Service (Object), which is more like a > transaction. Because the time required for handling higher level requests > is sufficiently greater than mere switching contexts, the difference might > become negligible. At the same time protected objects tend to be too > low-level. Further, protected actions shall be very short. This requirement > forces a very heavy design, when you have to do some prologue as a > protected action, continue work outside it, and complete it again as a > protected action again. Such things, and semaphore is a typical example of, > are exposed to various nasty problems. Ok thanks for the explanations, I understand very well and I'm able to make the comparisons with what I'm used to meet in C/C++. Sebastien