comp.lang.ada
 help / color / mirror / Atom feed
From: George J <ivanov_george@list.ru>
Subject: Re: Win32. Task or CreateThread
Date: Thu, 4 Aug 2016 23:15:01 -0700 (PDT)
Date: 2016-08-04T23:15:01-07:00	[thread overview]
Message-ID: <0ebd9eae-313d-4131-89c8-3cdb10937c2f@googlegroups.com> (raw)
In-Reply-To: <1dde5cdf-f1a8-4e5d-8d7d-60c89c554f6a@googlegroups.com>

пятница, 5 августа 2016 г., 7:25:45 UTC+3 пользователь George J написал:
> > So if you want the task to report back to GTK in any way (e.g. by moving 
> > the progress bar) you must do it by communicating with the task running 
> > the main loop. You can find an example how do do this here:
> > 
> > http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#1.1
> > .......
> > 
> > -- 
> > Regards,
> > Dmitry A. Kazakov
> > http://www.dmitry-kazakov.de
> 
> Hi All! I have a question for Gtk.Main.Routers, that i can't understand.
> I have next:
> 
> type My_Record is
> record
> .......
> end record
> 
> type My_Record_Access is access all My_Record;
> 
> Test_Record_Access : My_Record_Access;
> 
> package Cb_Request is new Gtk.Main.Router.Generic_Callback_Request(User_Data => My_Record);
> 
>    task type My_Task is  -- works well
>       entry Start;
>    end My_Task;
> 
>    task body My_Task is
>    begin
>       accept Start;
> 
>       Cb_Request.Request(Some_Proc'Access,Test_Record_Access); -- all ok
> 
>    end My_Task;
> 
> 
> But I need to send parameter to discriminant like this 
> .. in some proc 
> Some_Task.Start(Test_Record_Access)
> 
> and decl:
> 
>    task type My_Task is  -- works bad
>       entry Start(Rec_Acc:My_Record_Access);
>    end My_Task;
> 
>    task body My_Task is
>    begin
>       accept Start(Rec_Acc:My_Record_Access) do
>          Cb_Request.Request(Some_Proc'Access,Rec_Acc); -- "freezed"
>       end Start;
>    end My_Task;
> 
> 
> -----------
> I've debugged code and found:
> ...Gtk.Main.Routers(448)
> 
> procedure Request (Data : in out Request_Data'Class) is
>    begin
>       if Main = Current_Task then
>          Service (Data);
>       elsif Main = Null_Task_ID then
>          Log
>          (  GtkAda_Contributions_Domain,
>             Log_Level_Critical,
>             "No main task active" & Where ("Request")
>          );
>          raise Program_Error;
>       else
>          Gateway.Request_Service (Data, Standard.True);--<<---STOPPED HERE!!!!
>       end if;
>    end Request;
> 
> So I can understand, why it happened?can smb help with this!Thanks!

Oh, I've got another one! if i change

task body My_Task is
    begin
       accept Start; 
         Cb_Request.Request(Some_Proc'Access,Test_Record_Access); -- all ok 
    end My_Task;

to 

task body My_Task is
    begin
       accept Start do 
         Cb_Request.Request(Some_Proc'Access,Test_Record_Access); -- becomes "freezed"
       end Start;
    end My_Task;

i cant exec my proc again.

  reply	other threads:[~2016-08-05  6:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 14:38 Win32. Task or CreateThread George J
2016-08-02 15:22 ` Dmitry A. Kazakov
2016-08-02 16:39   ` George J
2016-08-03 17:31   ` George J
2016-08-03 19:43     ` Dmitry A. Kazakov
2016-08-04  2:42       ` George J
2016-08-05  4:25   ` George J
2016-08-05  6:15     ` George J [this message]
2016-08-05  6:17     ` Dmitry A. Kazakov
2016-08-05  6:48       ` George J
2016-08-03 20:31 ` Aurele
2016-08-04  2:41   ` George J
replies disabled

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