Re: Threads



Hi Paul,

Okay, I have a design flaw.  I am the only one who uses this app, so no harm done.  But I am still confused by the conversation here.  If I cannot use gdk_threads_idle_add()  then what can I do. 

I am confused because, I imagine, anticipate that creating a thread in the jack callback and running it calling an function that inserts text into a textbuffer will not work because I can only act on the main thread?

A simple code example of a solution would be helpful.

Craig Bakalian


On 10/18/2013 10:33 PM, Paul Davis wrote:



On Fri, Oct 18, 2013 at 10:24 PM, Jasper St. Pierre <jstpierre mecheye net> wrote:
On Fri, Oct 18, 2013 at 9:02 PM, Craig Bakalian <craigbakalian verizon net> wrote:
Hi,

I just updated to Ubuntu 13.10 and I have no support for

gdk_threads_enter();
gdk_threads_leave();

So, my app is crashing with signal errors.  I use a GtkTextView to enter midi data from a midi keyboard.  The midi keyboard sends and event to a jack callback process, which then sends a message to a GtkTextView.  And there is a thread issue because the midi jack callback is entering into the gtk_main().  So, in the past gdk_threads_enter(); gdk_threads_leave(); worked wonders for me. But, now no support.

Why would a JACK callback call gtk_main()? Something sounds wrong here.

Is there a work around for this depreciation?

The correct way to do this is to use gdk_threads_idle_add to schedule a method to be run on the UI thread. You can pass any data you want in here, e.g. the message to send ot the GtkTextView.

No, that is not correct either. The callback is not allowed to making any calls that could block. Unless gdk_threads_idle_add() has no locking, it cannot be used there. Only RT-safe inter-thread communication is allowed.

--p




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