comp.lang.ada
 help / color / mirror / Atom feed
* Failed Runtime Assertion: GNULLI failure---pthread_mutex_destroy
@ 1998-06-09  0:00 John McCabe
  1998-06-10  0:00 ` John McCabe
  0 siblings, 1 reply; 2+ messages in thread
From: John McCabe @ 1998-06-09  0:00 UTC (permalink / raw)



The code below is just a little experiment I am doing with getting task 
object to talk to each other (rather incestuously as it happens but 
that's beside the point).

I'm using GNAT 3.05 for DOS (I know it's out of date etc but...) on a 
Dell Optiplex Pentium 75. The first time I press 'n' there is no problem, 
but the 2nd time it raises the error in the header of this message.

Can anyone explain what would be causing this?
Does anyone know if this also happens with later versions of GNAT?

(Use Gnatmake t_proced.adb to compile - is there something I need to 
add?)

TIA

Filename: T_ACCESS.ADS
---------------
with Ada.Text_IO;

package T_Access is

   type Parent_Task;
   type Parent_Task_Pointer is access Parent_Task;
   
   type Child_Task;
   type Child_Task_Pointer is access Child_Task;
   
   task type Child_Task is
      entry Set_Parent (Parent_Pointer : Parent_Task_Pointer);
      entry Shut_Down;
   end Child_Task;

   task type Parent_Task is
      entry Set_Child (Child_Pointer : Child_Task_Pointer);
      entry Print_Out (Print_String  : String);
   end Parent_Task;

end T_Access;
---------------

Filename: T_ACCESS.ADB
---------------
with Ada.Text_IO;

package body T_Access is

   task body Child_Task is
      Shut_Down_Requested : Boolean := False;
      Timeouts            : Integer := 0;
      Parent              : Parent_Task_Pointer;
   begin
      accept Set_Parent (Parent_Pointer : T_Access.Parent_Task_Pointer) 
do
         Parent := Parent_Pointer;
      end Set_Parent;
      
      loop
         select
            accept Shut_Down do
               Shut_Down_Requested := True;
            end Shut_Down;
         else
            select
               Parent.Print_Out ("Hello" & Integer'IMAGE (Timeouts));
               Timeouts := 0;
            or
               delay 1.0;
               Timeouts := Timeouts + 1;
            end select;
         end select;
         exit when Shut_Down_Requested;
      end loop;
   end Child_Task;
   
   task body Parent_Task is
      Shut_Down_Requested : Boolean := False;
      Quit                : String (1..40);
      Quit_Len            : Integer;
      Child               : Child_Task_Pointer;
   begin
      accept Set_Child (Child_Pointer : T_Access.Child_Task_Pointer) do
         Child := Child_Pointer;
      end Set_Child;
      
      loop
         Ada.Text_IO.Put ("Do you want to quit [Y/N]? : ");
         Ada.Text_IO.Get_Line (Quit, Quit_Len);
         if ((Quit(1) = 'Y') or (Quit(1) = 'y')) then
            Shut_Down_Requested := True;
            Child.Shut_Down;
         else
            accept Print_Out (Print_String : String) do
               Ada.Text_IO.Put_Line (Print_String);
            end Print_Out;
         end if;
         exit when Shut_Down_Requested;
      end loop;
   end Parent_Task;

end T_Access;
---------------

Filename: T_PROCED.ADB
---------------
with Ada.Text_IO;
with T_Access;

procedure T_Proced is
  The_Child_Pointer  : T_Access.Child_Task_Pointer;
  The_Parent_Pointer : T_Access.Parent_Task_Pointer;
begin
  Ada.Text_IO.Put_Line("Creating the Child Task...");
  The_Child_Pointer := new T_Access.Child_Task;

  Ada.Text_IO.Put_Line("Creating the Parent Task...");
  The_Parent_Pointer := new T_Access.Parent_Task;

  Ada.Text_IO.Put_Line("Pointing the Child to the Parent...");
  The_Child_Pointer.Set_Parent (The_Parent_Pointer);

  Ada.Text_IO.Put_Line("Pointing the Parent to the Child...");
  The_Parent_Pointer.Set_Child (The_Child_Pointer);

  -- Now just need to wait for them to finish!
end T_Proced;
---------------

-- 
Best Regards
John McCabe

=====================================================================
Not necessarily my company or service providers opinions.
=====================================================================







^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Failed Runtime Assertion: GNULLI failure---pthread_mutex_destroy
  1998-06-09  0:00 Failed Runtime Assertion: GNULLI failure---pthread_mutex_destroy John McCabe
@ 1998-06-10  0:00 ` John McCabe
  0 siblings, 0 replies; 2+ messages in thread
From: John McCabe @ 1998-06-10  0:00 UTC (permalink / raw)



Sorry - wrong email address! If you have any information on this subject 
that you wish to send by email, please send it to:

john@assen.demon.co.uk

Thanks.

-- 
Best Regards
John McCabe

=====================================================================
Not necessarily my company or service providers opinions.
=====================================================================






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-06-10  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-09  0:00 Failed Runtime Assertion: GNULLI failure---pthread_mutex_destroy John McCabe
1998-06-10  0:00 ` John McCabe

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