comp.lang.ada
 help / color / mirror / Atom feed
From: "Jerry van Dijk" <jvandyk@ibm.net>
Subject: Re: Tasks and C/C++ code.
Date: 1998/11/12
Date: 1998-11-12T00:00:00+00:00	[thread overview]
Message-ID: <01be0dd2$aaff3da0$0100007f@aptiva> (raw)
In-Reply-To: 3649A4C4.4D3D22A2@hiwaay.net

> 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





  parent reply	other threads:[~1998-11-12  0:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-09  0:00 Tasks and C/C++ code Barry L. Dorough
1998-11-09  0:00 ` Mats Weber
1998-11-10  0:00 ` dennison
1998-11-11  0:00   ` dbotton
1998-11-11  0:00     ` Barry L. Dorough
1998-11-11  0:00       ` dennison
1998-11-12  0:00       ` Jerry van Dijk [this message]
1998-11-13  0:00       ` Mats Weber
1998-11-11  0:00     ` dennison
1998-11-18  0:00     ` Samuel Tardieu
1998-11-19  0:00       ` Mats Weber
1998-11-20  0:00         ` Samuel Tardieu
1998-11-23  0:00           ` Mats Weber
1998-11-23  0:00             ` Tom Moran
1998-11-24  0:00               ` Blocking protected ops (was: Tasks and C/C++ code) Mats Weber
1998-11-24  0:00                 ` Robert I. Eachus
1998-11-25  0:00                   ` Mats Weber
1998-11-25  0:00                     ` Robert I. Eachus
1998-11-26  0:00                       ` Simon Wright
1998-11-27  0:00                         ` David Botton
1998-11-27  0:00                           ` Tom Moran
1998-11-27  0:00                             ` Jerry van Dijk
1998-11-28  0:00                               ` Tom Moran
1998-11-27  0:00                           ` Mats Weber
1998-11-29  0:00                         ` Tucker Taft
1998-11-30  0:00                           ` Simon Wright
1998-11-25  0:00                     ` Jean-Pierre Rosen
1998-11-27  0:00                       ` Mats Weber
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox