Re: Threads

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

 



Hello there ... my 2 cents ... i don't know anything about JACK, but:

Main issue here is that gtk is not thread safe (neither is any gui). You
should not call anything from another thread that uses the GUI (althoug
gdk_thread_eneter/leave seems to be right for it).
Maybe replacing the enter/leave code by a call to g_idle_add or
g_main_context_invoke.

By the way, i think the Gtk folks should keep the API stable and not
remove anything until 4.0. People ported applications to gtk 3.0 and
then ... it does not work with 3.8. I don't know if QT is different, but
this should not be happening. A work around should have been implemented
to stay with gdk_threads_enter/leave.

cheers,
Luis Matos


Sáb, 2013-10-19 às 10:24 -0400, Paul Davis escreveu:
> 
> 
> 
> On Sat, Oct 19, 2013 at 7:46 AM, Craig Bakalian
> <craigbakalian@xxxxxxxxxxx> wrote:
>         On 10/19/2013 07:11 AM, Paul Davis wrote:
>                 There are dozens if not hundreds of "examples" of this
>                 - any JACK client with a GUI.
>                 
>                 But to get an idea of the basic idea, take a look in
>                 the JACK example clients and/or tools. jack_capture
>                 would be a good place to start, since it faces the
>                 problem of handing over incoming (audio) data to
>                 another thread.
>                 
>                 And no, you are not writing "the data" to a pipe from
>                 the JACK callback. The key ideas are (a) to move the
>                 data to another thread you need to use a lock-free
>                 data structure (b) if you need to wake the other
>                 thread (i.e. because it doesn't simply wake up
>                 periodically and use whatever new data you've
>                 delivered), you need to use the *most* RT-safe method
>                 you can. There are no absolutely RT-safe methods. A
>                 semaphore (on Linux anyway) is the best, writing a
>                 byte to a pipe is the 2nd best.
>                 
>                 You cannot make calls from the JACK callback that may
>                 block - you cannot write to disk, read from disk, take
>                 locks, etc, etc.
>                 
>                 This really should not be going to the gtk-list
>                 anymore. It has roughly nothing to do with gtk and
>                 more or less everything to do with JACK.
>                 
>         
>         
>         Hi Paul,
>         
>         If it has nothing to do with JACK, then why on earth was it
>         working before the latest release of gtk in ubuntu 13.10?  Why
>         could I write data out from the JACK callback with no issues
>         before??  It has nothing to do with the JACK callback and
>         everything to do with the overly secure removal of
>         
>         gdk_threads_enter();
>         gdk_thread_leave();
> 
> 
> You are not *allowed* to call these functions from a JACK callback,
> whether they exist or not.
> 
>  
>         
>         My application was working perfectly until the removal of
>         these functions.  Furthermore, once I remove the insert to the
>         gtktextbuffer from the callback, all is well.  And, the error
>         that pops up is that the gtktextbuffer layout can't get a line
>         number. This has nothing to do with JACK and everything to do
>         with threads in gtk.
> 
> 
> You are not allowed to interact with the GUI toolkit from the
> callback.
> 
> 
> If you use JACK you are doing realtime programming. I suggest a
> careful read of this to get you started:
> http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing
> 
> 
> The fact that you are handling MIDI and not audio doesn't change the
> applicability of Ross' advice.
> 
>  
>         
>         What on earth should I expect anything more than "get this off
>         this list" from I guy whose first response on a HELP list is
>         "Your design is wrong".  It is obvious to me you don't know
>         what my JACK callback is doing. 
> 
> 
> Maybe you don't understand that I wrote JACK. I run the JACK mailing
> list. That is where your questions belong. I'm just trying to be nice
> to the poor souls who wonder what this all has to do with GTK. And
> btw, moving to Qt won't address any of your fundamental issues.
> 
> --p
> 
> 
> 
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> https://mail.gnome.org/mailman/listinfo/gtk-list

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux