comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Advice, tasking and hardware
Date: Wed, 25 May 2016 18:09:54 -0700
Date: 2016-05-25T18:09:54-07:00	[thread overview]
Message-ID: <ni5i6c$a2u$1@dont-email.me> (raw)
In-Reply-To: <25c43463-47ca-4021-82ee-299e6a075faa@googlegroups.com>

On 05/25/2016 02:24 PM, patrick@spellingbeewinnars.org wrote:
>
> I struggled to find a GUI binding I liked and I struggled to work with C. I
> wanted to use Ada to avoid using C and I didn't understand C well.
>
> For the past few years I have been using GnuCOBOL. I absolutely love it. It
> is much easier to interface to C with and it compiles to intermediate C so
> it's easier to see what is happening rather then going from Ada to Assembly.
> While the interfaces.COBOL package is quite outdated and does not have
> knowledge of modern COBOL it does work well and I can mix the two languages.

I'm not sure what you're getting at here. A compiler's intermediate code is 
usually of no interest to a developer. I've done more interfacing to C from Ada 
than I'd like, and it's usually straightforward.

> I don't have any experience with tasking though and while I have many
> examples of tasking in my books, none of them seem to call low level
> functions such as drivers or driver-like functions. I am planning on using
> the Linux-GPIB library.

Every call to a subprogram in Ada, be it high-level or low-level, is made by a 
task. The elaboration and the the main-program subprogram are executed by the 
environment task. Any subprogram calls made, directly or indirectly, by the main 
program are made by the environment task. I see no reason why you should expect 
calls from user-defined tasks to be any different.

> Spark doesn't use tasking, are there many dangers in using tasking with
> hardware?

SPARK 2014 includes Ravenscar tasking. 
(http://docs.adacore.com/spark2014-docs/html/lrm/tasks-and-synchronization.html)

I don't know how you'd use tasking without hardware. Concurrent development is a 
superset of sequential development, and some who are competent at the latter 
have difficulty with the former, even after extensive experience. Deadlock and 
race conditions are common dangers if you don't understand concurrency (and 
sometimes if you do).

> Would it be wise to wrap C driver calls in a protected object or are most
> drivers in Linux thread safe and suitable for being called from different
> threads?

That will depend on the library you're binding to, and you should refer to its 
documentation. If in doubt, wrapping the calls in a PO will ensure they are made 
sequentially.

-- 
Jeff Carter
"He didn't get that nose from playing ping-pong."
Never Give a Sucker an Even Break
110


  reply	other threads:[~2016-05-26  1:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 21:24 Advice, tasking and hardware patrick
2016-05-26  1:09 ` Jeffrey R. Carter [this message]
2016-05-26  8:13   ` Simon Wright
2016-05-26  7:26 ` Dmitry A. Kazakov
2016-05-26 16:41   ` patrick
2016-05-26 17:56     ` Dmitry A. Kazakov
2016-05-26 20:35     ` Jeffrey R. Carter
2016-05-26 19:35   ` Jeffrey R. Carter
2016-05-26 20:51     ` patrick
2016-05-27  7:50     ` Dmitry A. Kazakov
2016-05-27 18:00       ` Simon Wright
2016-05-27 19:06       ` Jeffrey R. Carter
2016-05-27 22:05         ` Randy Brukardt
2016-05-27 23:09           ` Jeffrey R. Carter
2016-05-27 19:13       ` Shark8
2016-05-27 20:27         ` Dmitry A. Kazakov
2016-05-27 22:27           ` Randy Brukardt
2016-05-28  6:49             ` Dmitry A. Kazakov
2016-05-28 14:38           ` Shark8
2016-05-28 15:45             ` Dmitry A. Kazakov
2016-05-28  0:25 ` rieachus
2016-05-28  1:57   ` patrick
2016-05-28  4:13   ` Jeffrey R. Carter
2016-06-01 14:37     ` rieachus
2016-06-01 19:09       ` Dmitry A. Kazakov
2016-06-06  3:33         ` rieachus
2016-06-06  7:18           ` Dmitry A. Kazakov
2016-06-07 16:53             ` rieachus
2016-06-07 20:21               ` Dmitry A. Kazakov
2016-06-08  4:06                 ` rieachus
2016-06-08  7:29                   ` Dmitry A. Kazakov
2016-06-08 12:56                     ` rieachus
2016-06-08  0:19               ` Dennis Lee Bieber
replies disabled

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