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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,94e5dd5646e21259 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Interfacing to C: multithreaded callbacks Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1181678190.757347.67290@x35g2000prf.googlegroups.com> Date: Wed, 13 Jun 2007 10:11:30 +0200 Message-ID: NNTP-Posting-Date: 13 Jun 2007 10:08:52 CEST NNTP-Posting-Host: 6cb68b77.newsspool2.arcor-online.net X-Trace: DXC=XWb[TE[Y[b7L2C_`koXfC5A9EHlD;3Yc24Fo<]lROoR18kF7enW;^6ZC`4IXm65S@:3>?`jPc@>:31A8 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16177 Date: 2007-06-13T10:08:52+02:00 List-Id: On Tue, 12 Jun 2007 12:56:30 -0700, Maciej Sobczak wrote: > The problem is when the C library creates additional threads and calls > the client back in the context of those threads. ARM says nothing (?) > about the relaion between Ada tasks and system threads. If the > relation is 1:1 (ie. tasks are implemented as system threads), then > the whole scheme might work just fine, provided that there is no task- > specific data that Ada runtime expects and will not find. On the other > hand, if the relation between tasks and threads is not 1:1, we will > just enjoy undefined behavior. Yes, when Ada tasks aren't mapped onto system threads, then system calls potentially might block all Ada tasks. This includes whatever POSIX layer. > Is there any water-proof implementation pattern for such problems? > Consider both the general case and then GNAT as the target Ada > compiler on POSIX systems. You can marshal messages from C callbacks. With busy waiting and one publisher - one subscriber, you don't need anything but shared memory to implement that. However, when talking about POSIX targets, I would assume Ada tasks being POSIX threads. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de