glib main content/loop issue



Hello!
I am having a problem with the glib main context. This is running on
Ubuntu Linux 8.0.4. I have an app that needs to spawn and control
another app. I am calling g_spawn_async_with_pipes from a secondary
thread in a shared library, not the main app. I manually create and
attach GSource objects and callbacks for the stdin, stdout and stderr
pipes. I then create my own CMainContext object and enter a loop calling
g_main_context_iteration with my context and FALSE for the blocking
parameter. I then check to see if an event has been signaled using a 10
msec timeout. If the event has not been signaled then I continue
looping. The event will be signaled based on messages from the stdout
pipe. This works fine.

The problem is that *IT SEEMS* like the main loop in my exe has stopped
and I can't get it started again. When the called app terminates, I
signal that subsequent processing should resume. This involves sending a
message to the original app main loop, but nothing happens. When I break
into GDB the app is waiting at a poll function (sorry, I can't remember
the exact function) even though I sent a message that should have
triggered more processing. I set a breakpoint in the shared library code
that should be invoked in response to that message but it is never hit.
We are using GTK, GTKMM and GDK, so I really don't know 'who' is
responsible for the app main loop (I think that it all comes down to
GLIB).

I have tried sending that 'continue' message both from the thread with
the secondary main context 'loop' and from the original app main thread
(both in the shared library), but both fail the same way. I have also
tried calling g_main_context_wakeup(NULL) back in the main app thread
(in the shared library), but that didn't help either.

I would really appreciate it if someone could help me understand why I
can't get the original app main loop to receive and process my messages.
I have read the GLIB info and suspect that there may be a problem with
the fact that I am running in a shared library.

Thank you,
Chuck Crisler




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