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-7-bit X-Google-Thread: 103376,5d05ccde5cefb836 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Blocking protected ops (was: Tasks and C/C++ code) Date: 1998/11/24 Message-ID: #1/1 X-Deja-AN: 415260549 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> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-11-24T00:00:00+00:00 List-Id: In article <365AD980.5729FCD8@elca-matrix.ch> Mats Weber writes: > Anyway, the question remains: is it legal for a protected body to call > some imported subprogram that could block (in the pthreads sense of the > term) ? You quoted the answer yourself, it is a bounded error per 9.5.1(8&16) seem to cover it completely. > Does someone know why the rule 9.5.1(8-18) is there at all ? To rigorously define the conditions where you should allow for the possibility of deadlocks and other blocking problems. Some deadlocks (or worse, race conditions) can't be ruled out, because they are inherent in the nature of the beast. Subclause 9.5.1 limits the number of programs that are potentially affected by this, in part by strongly encouraging programmers not to do that! This is a perfect example. Most compilers will generate code to call gethostbyname within a protected subprogram, but most users will be encouraged by the RM to do it right. In this case really right is probably to put the potentially offensive call in a task (or protected object) that encapsulates all potentially locking OS calls. If you are on a symmetric multiprocessor, you may be able to have several such guards. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...