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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,115d7688c91613a5 X-Google-Attributes: gid103376,public From: Joerg Kienzle Subject: Re: Interrupt problem in GNAT Date: 1999/05/20 Message-ID: <3743CB6E.AA029CDC@epfl.ch>#1/1 X-Deja-AN: 479997695 Content-Transfer-Encoding: 8bit References: <3742DC0D.B8F07A52@epfl.ch> <7huup6$qoa@hobbes.crc.com> X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Trace: 20 May 1999 10:44:30 +0100, lglsun3.epfl.ch Organization: EPFL MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-20T00:00:00+00:00 List-Id: First of all, thanks for your reply! "David C. Hoos, Sr." wrote: > > Joerg Kienzle wrote in message <3742DC0D.B8F07A52@epfl.ch>... > > > > You did not say on which platform you are trying to do this, so > I'm assuming sparc and not x86 Solaris. Yes, it's on a Ultra 1 Sparc. > > There is a problem with what you're trying to do. > > First, if you use the dynamic attach instead of the static (pragma), > you will find that Interrupt 14 (Sigalrm) is reserved, and Program_Error > is raised. Apparently with the static attach, it just silently fails. Well, on my machine, even when using dynamic attach, there's no Program_Error. > I have always used the dynamic attach myself, but I just tried your > program with SIGTERM and SIGWINCH, by outputting a line of > text in the Tick procedure. Both of those signals work with either > static or dynamic attach on a SPARCstation-10 with SunOS 5.5.1, > sending the signals with kill or kill -WINCH . You are right! It also works on my machine, if I send the signals from outside via kill! Hmm... Seems like the signals are delivered in a different way... Here's the code I use to set up the signals: procedure Main is type Timespec is record Tv_Sec : C.Long; TV_nsec : C.Long; end record; pragma Convention (C, Timespec); type Itimerspec is record It_Interval : Timespec; It_Value : Timespec; end record; pragma Convention (C, Itimerspec); type Sigevent is record Sigev_Notify : C.Int; Sigev_Signo : C.Int; Sigev_Value : C.Long; end record; pragma Convention (C, Sigevent); procedure Timer_Create (Clock_Id : C.Int; Evp : Sigevent; Timerid : out C.Int); pragma Import (C, Timer_Create, "timer_create"); My_Timer : C.Int; procedure Create_Timer; procedure Create_Timer is S : Sigevent; begin S.Sigev_Notify := C.Int (2); -- This specifies SIGEV_SIGNAL S.Sigev_Signo := C.Int (SIGTERM); Timer_Create (C.Int (0), S, My_Timer); end Create_Timer; procedure Timer_Settime (Timer_Id : C.Int; Flags : C.Int; Value : Itimerspec; Ovalue : in out Itimerspec); pragma Import (C, Timer_Settime, "timer_settime"); procedure Set_Time (I : in Natural) is New_Value : Itimerspec; Old_Value : Itimerspec; begin New_Value.It_Interval.Tv_Sec := C.Long (I); New_Value.It_Interval.Tv_NSec := C.Long (0); New_Value.It_Value.Tv_Sec := C.Long (I); New_Value.It_Value.Tv_NSec := C.Long (0); Timer_Settime (My_Timer, C.Int (0), New_Value, Old_Value); end Set_Timetimer; begin Create_Timer; Set_Time (6); while True loop delay 1.0; end loop; end Main; > Have you ever considered just using the facilities of Ada to do > what you want? Of course, this would be the best way to do it... It's just that someone asked me if I can do it with interrupts... - J�rg -- --------------------------------------------------------------------------- - Joerg Kienzle - Swiss Federal Institue of Technology - CH-1015 Lausanne - - email : Joerg.Kienzle@epfl.ch WWW : http://lglwww.epfl.ch/~jkienzle/ - - phone : ++41 21 693 42 37 fax : ++41 21 693 50 79 -