[Goodies-dev] [Goodies-commits] r1753 - in verve-plugin/trunk: . panel-plugin

Jannis Pohlmann jannis at xfce.org
Thu Jul 13 12:31:53 CEST 2006


On Thu, 13 Jul 2006 10:46:15 +0200, Benedikt Meurer wrote:

> Jannis Pohlmann wrote:
> > Oh, I think I finally understand how this mutex locking works. The
> > name passed to G_LOCK_DEFINE_STATIC, G_LOCK, G_UNLOCK is just an
> > alias to identify the mutex, right? At first, I thought it has to
> > be named after the variabe which one wants to lock ... 
> > 
> > Ok, here's what I guess should work.
> > 
> > verve-plugin.c:
> > 
> >   G_LOCK_DEFINE_STATIC (plugin_completion_mutex);
> > 
> >   void
> >   verve_plugin_load_completion (VerveEnv* env, gpointer user_data)
> >   {
> >     VervePlugin *verve = (VervePlugin*) user_data;
> >     ...
> >     G_LOCK (plugin_completion_mutex);
> > 
> >     verve->completion = g_completion_new (NULL);
> > 
> >     /* Add command history to completion */
> >     if (G_LIKELY (history != NULL)) 
> >       g_completion_add_items (verve->completion, history);
> >   
> >     /* Add binaries to completion list */
> >     if (G_LIKELY (binaries != NULL))
> >       g_completion_add_items (verve->completion, binaries);
> > 
> >     G_UNLOCK (plugin_completion_mutex);
> >   }
> > 
> >   ...
> > 
> >     g_signal_connect (G_OBJECT (verve_env_get()), "load-binaries",
> >       G_CALLBACK (verve_plugin_load_completion), verve);
> > 
> >   ...
> > 
> > verve_plugin_load_completion is a callback for reacting on the
> > "load-binaries" signal, emitted by the worker thread after it has
> > loaded all binary files in $PATH into the completion. 
> > 
> > Would this work (which I hope ...)?
> 
> Looks good. Plus you'll need to protect the read access to the
> completion with G_LOCK()/G_UNLOCK().
> 
> > And do I need to wrap the
> > signal_emit_by_name (in the worker thread) in
> > gdk_threads_enter/leave calls?
> 
> Only if you are using the global GDK lock, which I don't recommend.

Commited, thanks for your help. I hope this will work.

Regards,
Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/goodies-dev/attachments/20060713/5cdfa3e0/attachment.pgp>


More information about the Goodies-dev mailing list