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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC 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: kaz@ashi.footprints.net (Kaz Kylheku) Subject: Re: Ada Protected Object Tutorial #1 Date: 1999/12/18 Message-ID: #1/1 X-Deja-AN: 562442008 Cache-Post-Path: ashi.FootPrints.net!unknown@localhost 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> X-Complaints-To: abuse@direct.ca X-Trace: brie.direct.ca 945553048 204.239.179.1 (Sat, 18 Dec 1999 13:37:28 PST) Organization: Psycho-Neurotic Institute for The Very, Very Nervous X-Cache: nntpcache 2.3.3b3 (see http://www.nntpcache.org/) User-Agent: slrn/0.9.5.7 (UNIX) Reply-To: kaz@ashi.footprints.net NNTP-Posting-Date: Sat, 18 Dec 1999 13:37:28 PST Newsgroups: comp.programming.threads,comp.lang.ada Date: 1999-12-18T00:00:00+00:00 List-Id: On Sat, 18 Dec 1999 20:38:19 GMT, Robert A Duff wrote: >> These solution requires some measure of clairvoyance: what if the protected >> procedure calls into another subsystem which then calls back into a protected >> procedure on the same object? How do you pass the ``already_locked'' knowledge >> across calls to foreign subsystems? > >That situation is, by definition, an "external" call. It will attempt >to lock the protected object, and since it's the same object, it will >deadlock. It's only in well-defined (compile-time-known) cases that are >defined as "internal" calls. That's good! I like that. (I mean, I don't like deadlock, but I like the rules :). >> The solution is probably to use recursive locks, which check the ID of the >> calling against an ownership ID stored in the lock. Recursive locks are >> slightly inefficient because they have to retrieve the ID of the current thread >> and compare it. > >If you want recursive locks in Ada, you have to program them yourself -- >the run-time system doesn't do that automatically. Again, that is good. Recursive locks are brain-damaged.