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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,5d05ccde5cefb836 X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Blocking protected ops (was: Tasks and C/C++ code) Date: 1998/11/25 Message-ID: <73gtdh$g7i$1@platane.wanadoo.fr>#1/1 X-Deja-AN: 415504697 Content-Transfer-Encoding: 8bit References: <364702E5.F6987321@hiwaay.net> <729ndu$jfo$1@nnrp1.dejanews.com> <72b35b$pll$1@nnrp1.dejanews.com> <87btm52jwl.fsf@zaphod.enst.fr> <3654746F.3C297E56@elca-matrix.ch> <87k90qunxl.fsf@zaphod.enst.fr> <36599BE3.BA30555B@elca-matrix.ch> <3659b3a8.386623@news.pacbell.net> <365AD980.5729FCD8@elca-matrix.ch> <365BE117.59209A5@elca-matrix.ch> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 Organization: Adalog Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-11-25T00:00:00+00:00 List-Id: Mats Weber a �crit dans le message <365BE117.59209A5@elca-matrix.ch>... >I still don't see why an accept statement is allowed to contain a >potentially blocking call, but a protected procedure is not. > Because a protected type is much lower level than tasks. On a multi-processor, the protection can be implemented by busy-waiting on a global lock; you don't want to allow a task to be stuck in the protected object for a long time. There is no such issue for tasks (which is BTW why tasks and rendezvous are still useful). My own rule of thumb: if it's simple, low-level and quick, use a protected type. Otherwise, and especially if it's a high level operation, or if you need to do more that checking a boolean or bumping a counter, use tasks. ---------------------------------------------------------------------- ------ J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://perso.wanadoo.fr/adalog