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: ffc1e,fb45e48e8dddeabd X-Google-Attributes: gidffc1e,public X-Google-Thread: 103376,fb45e48e8dddeabd X-Google-Attributes: gid103376,public From: Laurent Guerby Subject: Re: Ada Protected Object Tutorial #1 Date: 1999/12/19 Message-ID: <86zov7j0xy.fsf@ppp-116-44.villette.club-internet.fr>#1/1 X-Deja-AN: 562462418 References: <839toq$pu$1@bgtnsc03.worldnet.att.net> <3858E5B3.9AB004E9@bton.ac.uk> <385984BC.1FB1@hello.nl> <86aen9z7qi.fsf@ppp-111-13.villette.club-internet.fr> <86u2lgvumy.fsf@ppp-116-44.villette.club-internet.fr> X-Trace: front4m.grolier.fr 945558636 2626 195.36.163.7 (18 Dec 1999 23:10:36 GMT) Organization: Club-Internet (France) NNTP-Posting-Date: 18 Dec 1999 23:10:36 GMT Newsgroups: comp.programming.threads,comp.lang.ada Date: 1999-12-18T23:10:36+00:00 List-Id: kaz@ashi.footprints.net (Kaz Kylheku) writes: > That's good. I follow the same principles generally, but without > language help it's easy to make mistakes like do some blocking > thing inside a tight critical section or create deadlock. Agreed. > What do you do if you need a protected procedure to call out into > some other module which then calls back? You wouldn't do this inside the protected procedure code. > Using explicit locks, I just unlock, do the call, lock again > thereby avoiding deadlock. That's how you would do it in Ada too (with an explicit mutex and caller care). The protected objects aren't designed to solve this kind of problem, they solve cleany most of the cases, if you have a complex nested locks scheme, you have to do it by hand (note that the GNAT runtime just does this, it has a very fine grained locking model by default to allow concurrency inside itself). > Though I don't use Ada, I have a hard copy of the standard somewhere under my > desk, so I can take a look. Or online: You can get the annotated version (giving the insight on the language design) in ASCII at (There is also a PostScript version, beware it's 800 pages ;-). --LG