Re: gtk main and slemr main

Every CORBA implementation I'm aware of provides the ability
to use an external event loop for getting notification when
file descriptors that are ready for reading. 

Integrating this type of thing with GTK+ is easy - when
the library requests notification on a file descriptor,
you use g_io_add_watch (). 

I'm not familiar with the "Middleware" application/library 
that you are talking about, but adding this capability should
be reasonably easy if it doesn't already have it. (And this
feature is really a requirement for any serious library 
of this sort.)

GTK+'s main loop is not designed to be used as a slave main
loop - basically because GTK+ expects a better and more flexible
main loop than would be provided by most other libraries.
So the approach of trying to check for GTK+ events occasionally
is not going to work reliably, though people have sort of hacked
to to work when really desparate.


Matt Eisemann <meisemann dsrnet com> writes:

> There may be a problem with using gtk and middleware together in the same 
> application.  I was talking with Tom Phelan and he said that I can't have 
> two main loops even though they are both waiting for different events to 
> occur.  He mentioned some potenntially tricky scenarios.  One, that they 
> did in Middleware once to solve this dilemma was to modify the middleware 
> main loop and include the other event check in it, which probably is not a 
> great solution.  For example, the following is
> {
>   while(1)
>   {
>    middleware event_check;
>    gtk event check
>   }
> }
> Secondly, I could create my own task loop and get the function calls that 
> middlware uses and then include the API's that gtk_main() uses.  For 
> example,
> somethine like.
> While(1)
> {
>   middleware event check;
>   gtk event check;
> }
> If gtk does not provide the source code or API's to gtk_main, I don't see 
> how I am going to use middleware and gtk together.  Either way, this is 
> going to increase my project time since I am going to have to do some 

[ Of course, the source code to gtk_main() is available, like
  the source to the rest of GTK+ ]

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