|
From: Pavel L. <pa...@ce...> - 2013-02-01 18:50:19
|
On 30/01/13 23:42, James Morris wrote:> Ah yes, that makes a lot of sense, I hadn't really delved in deep to > look at what is happening with the creation of conky objects. I'll > use a counter incremented on calls to jack_init and decremented > in jack_close, and only call jack_client_close when the counter reaches > zero (unless conky already has a mechanism for this?). No mechanism (in the 1.9 branch), as you have already figured out. >> Also I find that semaphore thingy quite strange. What exactly are you >> trying to achieve there? > > My grasp of multi-threading is a bit weak, so that's just something > I've taken from another project[1]. jack_shutdown_cb() is called by > JACK[2] never by conky so the semaphore is there to cause this > communication between different process threads to hopefully happen in > a thread safe manner! You should read up on cargo cult programming <http://en.wikipedia.org/wiki/Cargo_cult_programming>. Then, try to avoid it. :) On 31/01/13 01:57, James Morris wrote: > Since many of the functions we're using to obtain information > about the JACK server require registration as a client we need to > know when we no longer are a JACK client otherwise we'll get > the dreaded sig-segv - which considering conky's main task is NOT as a > JACK client, would be poor going. Segfaults are bad irrespective of whether something is your main purpose or not. > The JACK client should be opened just the once - by the first object > which needs to, but only closed when conky exits. Otherwise if the > only JACK object exists within a LUA script, the JACK client will be > opened then closed on every update, which is unacceptable (it causes > pops + clicks on my system). > > So I've removed the call to jack_close() from free_text_objects() in > core.c and placed it near the end of main() in conky.c. It's a lot more > sensible and follows the normal way of doing things. I figured this will come up. I do not particularly like this behavior, but as pretty much every object in conky does this, i cannot really rub you down for it. :D However, I do intend do get rid of this stuff in the 2.0 release. All in all, it looks fairly ok. I'll try to have a closer look at this stuff over the weekend and, hopefully, merge it. Cheers, pl |