Re: Idle Function Not Getting Called

Then you must have some function blocking between your call to g_idle_add_full() and control returning to the main loop.

Anything in a GTK+ signal or event handler must not block. This means in practice that nothing should block after your call to gtk_main().

After spending more time with my code I'm just not seeing it. Below is the pertinent code.

AddName() is called from a drop-down menu item.

Via debug code I've seen that the program flow is as it should be ... all functions are exited. The first idle function (PlayNetGame()) is added, executed, and exited as it should be. The second idle function (PlayTheGame()) is added but is never called.

Does anyone see what might be blocking the call of PlayTheGame() or have any other suggestions?

I have not tried to find it in the code, but as your application is multi-threaded you are showing the symptoms of a deadlock, either by recursive locking or more likely by out of order locking. Can you run the code through a deadlock checker, or if not can you by appropriate breakpoints find out if it is occurring in a mutex lock?

I can't find a non-commercial deadlock checker for Linux. I agree that the multi-threaded facet of the code is causing my problem but so far I'm having trouble using breakpoints/debug code to isolate the exact cause.

The mutex locks/unlocks are only in a secondary thread and an idle function. I assume there's no problems with idle functions using mutexes?

Marshall Lake -- mlake mlake net --

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