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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME 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: "Jerry van Dijk" Subject: Re: Tasks and C/C++ code. Date: 1998/11/12 Message-ID: <01be0dd2$aaff3da0$0100007f@aptiva>#1/1 X-Deja-AN: 410914289 References: <364702E5.F6987321@hiwaay.net> <729ndu$jfo$1@nnrp1.dejanews.com> <72b35b$pll$1@nnrp1.dejanews.com> <3649A4C4.4D3D22A2@hiwaay.net> X-Notice: should be reported to postmaster@ibm.net X-Complaints-To: postmaster@ibm.net X-Trace: 12 Nov 1998 01:14:19 GMT, 139.92.162.214 Organization: JerryWare Newsgroups: comp.lang.ada Date: 1998-11-12T00:00:00+00:00 List-Id: > So, if I understand correctly defining the pragma to C in the declaration part of > the task body will give me multiple binding to the same function if there are > multiple tasks? This is still confused. Forget about tasks for the moment. If you call a C function it will be in some C library. Therefore, there is only one copy of this function, namely the one in this C library. The question whether or not this C function is thread (task) safe, depends on how the function is written. Consult the documentation or source code of the function to find out. All this has absolutely nothing to do with either Ada or Tasking, only with C. Now think about tasking again. Every task that generates a _call_ to this C function will address only this single function in this specific library. Ada is not about to generate C functions for you! So, if the C function you want to use is not thread (task) safe, you need to make sure that it is only accessed by a single task at the time. One of the solutions is to put the C function call in a separate task. -- -- Jerry van Dijk | Leiden, Holland -- Team Ada | email: jdijk@acm.org -- Ada & Win32: http://stad.dsl.nl/~jvandyk