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, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5c11488f5a203885 X-Google-Attributes: gid103376,public From: robert_dewar@my-dejanews.com Subject: Re: Imported Monolitic Monitor Date: 1999/03/08 Message-ID: <7c0kvm$1ar$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 452554795 References: <36E014CD.55717933@unex.es> <7bpgb7$bmm$1@nnrp1.dejanews.com> <7bv4jv$7om$1@plug.news.pipex.net> X-Http-Proxy: 1.0 x5.dejanews.com:80 (Squid/1.1.22) for client 166.72.69.226 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Mar 08 13:57:15 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-03-08T00:00:00+00:00 List-Id: In article <7bv4jv$7om$1@plug.news.pipex.net>, "Nick Roberts" wrote: > Two further small matters. Firstly, "yup" means "yes". > Secondly, if any of the C functions (a, b, or c) only > reads the global data (but does not change it), make it > be called by a 'function' in Ada (inside the protected > object), rather than a 'procedure'. This may execute > slightly more efficiently (because it will allow multiple > tasks to read the data at the same time). The "will" here is wrong, the right verb is "may". In fact we have found that most operating systems lack the primitives to allow simultaneous reading, so usually in GNAT, functions do not permit this kind of access, and they use a mutual exclusion lock identical to the lock used for procedures (as of course permitted by the RM). Yes, you could rig up a higher level layer allowing this synchronization, but given the usual expectation of protected subprograms being short, this would probably increase overhead rather than decrease it. In any case, I suggest programmers choose between procedures and functions in this situation on the basis of which is the better abstraction. Worrying about low level implementation details is not the way to create pleasant interfaces! -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own