comp.lang.ada
 help / color / mirror / Atom feed
From: jidu2851@student.uu.se (Jimmy Dubén)
Subject: Re: Use of entries using Ravenscar
Date: 20 Dec 2001 05:52:43 -0800
Date: 2001-12-20T13:52:43+00:00	[thread overview]
Message-ID: <4948089f.0112200552.2b137487@posting.google.com> (raw)
In-Reply-To: jChU7.363$US4.115186@news2-win.server.ntlworld.com

> You couldn't provide an actual code example? I've been playing with
> the Ravenscar profile for a few months now and have never had any
> problem with it.

Okidoki.. here goes.
I have three different files below (sorry, I could not send them
along...).
One procedure that uses the PO, and then a package with the PO that
has the entry.
Originally the code was intended to catch a signal but that did not
work with ravenscar either. Strange since I think it is statically
attached.
Pragma(Ravenscar) not shown here (used in gnat.adc next to Makefile)


<<<<<<<<<<<<CODE>>>>>>>>>>>>

>>>>>>>>test_entry.adb

with Ada.Real_Time, Ada.Text_IO, Signal_Handler_Test;
use Ada.Real_Time, Ada.Text_IO, Signal_Handler_Test;

procedure Test_Entry is
   Period        : constant Duration := 5.0;
   Next_Time     : Time;
begin
   loop
      Next_Time := Clock + To_Time_Span (Period);
      delay until Next_Time;

      Protected_Signal_Handler_Test.Read;
   end loop;
end Test_Entry;

>>>>>>>>>signal_handler_test.ads
with
  Ada.Interrupts,
  Ada.Text_IO,
  Ada.Interrupts.Names;

use
  Ada.Interrupts,
  Ada.Text_IO,
  Ada.Interrupts.Names;

package Signal_Handler_Test is

   protected Protected_Signal_Handler_Test is

      --*F
      --* Read entry ...
      --*E
      entry Read;

      --*F
      --* Report that signal USR1 has occured
      --*E
      procedure Something_Arrived;

      -- Attach this certain procedure to the correct signal
      -- NOT ANY MORE
      --pragma Attach_Handler(Something_Arrived, SIGUSR1);

private
      -- Whether or not there is anything to "read"
      Exists_Something   : Boolean := False;
      No_Of_Something   : Integer := 0;


   end Protected_Signal_Handler_Test;

end Signal_Handler_Test;

>>>>>>>>>signal_handler_test.adb

package body Signal_Handler_Test is

   protected body Protected_Signal_Handler_Test is

      
      entry Read when Exists_Something is
      begin

         -- Decrement message counter
         No_Of_Something := No_Of_Something - 1;
         Put_Line("Read: Something is = " & No_Of_Something'img);

         -- (Possibly) allow others to use the entry again
         Exists_Something := No_Of_Something > 0;

      end Read;


      procedure Something_Arrived is
      begin

         Ada.Text_IO.Put_Line("Something_Arrived: A message has
arrived.");

         -- Increment something counter
         No_Of_Something := No_Of_Something + 1;
         Put_Line("Something_Arrived: Something is = " &
No_Of_Something'img);

         -- A something is available now
         Exists_Something := True;

      end Something_Arrived;

   end Protected_Signal_Handler_Test;

end Signal_Handler_Test;

>>>>>>>>>>>>>NO MORE CODE<<<<<<<<<<<<<<

In the system I'm working with we, among other things, want to catch a
signal from a CAN-driver to be able to do a non-blocking read. (We
can't find good drivers to our CAN-module that is working with Linux
2.4.15)



  reply	other threads:[~2001-12-20 13:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-18 16:28 Use of entries using Ravenscar Jimmy Dubén
2001-12-20  7:54 ` Jimmy Dubén
2001-12-20  8:46   ` martin.m.dowie
2001-12-20 13:52     ` Jimmy Dubén [this message]
2001-12-20 14:59   ` Stephen Leake
2001-12-20 15:14     ` martin.m.dowie
2001-12-20 20:34       ` Jimmy Dub�n
2001-12-21 22:47         ` martin.m.dowie
2001-12-22  1:52           ` Jimmy Dub�n
2001-12-22 15:27             ` martin.m.dowie
2001-12-22 22:56               ` Jimmy Dub�n
2001-12-23 11:02                 ` martin.m.dowie
2001-12-22 12:25     ` Simon Wright
2001-12-23 18:48       ` Jimmy Dub�n
2001-12-26 18:02         ` Simon Wright
2001-12-23 20:01       ` Stephen Leake
2001-12-24  8:52         ` Jimmy Dub�n
2001-12-26 18:20           ` Simon Wright
2001-12-27 10:57             ` Jimmy Dub�n
2001-12-28 18:36               ` Simon Wright
2001-12-27 11:11             ` Florian Weimer
replies disabled

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