comp.lang.ada
 help / color / mirror / Atom feed
From: Sébastien <seb.morand@gmail.com>
Subject: Re: Task vs Protected Type
Date: Fri, 30 May 2008 16:09:56 +0000
Date: 2008-05-30T16:09:56+00:00	[thread overview]
Message-ID: <484026D4.9040708@gmail.com> (raw)
In-Reply-To: 


>    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



  reply	other threads:[~2008-05-30 16:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 14:12 Task vs Protected Type Sébastien
2008-05-30 14:33 ` Dmitry A. Kazakov
2008-05-30 16:09   ` Sébastien [this message]
2008-05-30 15:15 ` Jean-Pierre Rosen
2008-05-30 17:30 ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox