Re: Experimenting with no gtk_main()

On 12-04-19 10:09 AM, David Nečas wrote:
On Thu, Apr 19, 2012 at 09:58:37AM -0400, Patrick wrote:
I am trying to control gtk from a specific thread in another
language, I don't want a blocking call like gtk_main() because I
want the thread to interact with other threads periodically.
Blocking gtk_main() and periodic interaction are not in conflict.

If a single iteration of the Gtk+ main loop, i.e. gtk_main_iteration(),
does things that take too long for your requirement of periodicality
then you are in trouble anyway and running gtk_main_iteration()
explicitly buys you nothing.  You will still get too long delays due to

If a single interation of the main loop does not take too long then you
can just run gtk_main() and perform the regular inter-thread interaction
in a source registered to the Gtk+ main loop, e.g. using


Hi Yeti

Thanks for answering my post :)

I didn't want to clutter the list with my weirdness but here is specifically what I am trying to do:

I am trying to run most of my application in Ada. I know there is a binding already but I would prefer my own DIY option. I would like to write a tiny skeleton C Gtk app and then control it from an Ada thread. I realize there are all sorts of facilities to program gtk apps in C, including threading but I would like to stick to Ada whenever possible.

The long running task I am concerned about is on the Ada side and is not a callback from the gui.

I would like the main loop to be in Ada. It would call updates on my C gtk part, rendezvous with the other long running thread quickly to exchange data and then return to looping the gtk part. If I call gtk_main it will block the Ada thread.

Hope this makes sense. While I hope to change this one day, at the moment I am just an amateur coder...

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]