[packagekit] pk_backend_finished race issue

Richard Hughes hughsient at gmail.com
Fri Sep 14 00:08:48 PDT 2007

On 13/09/2007, Richard Hughes <hughsient at gmail.com> wrote:
> On 13/09/2007, Tom Parker <palfrey at tevp.net> wrote:
> > Richard Hughes wrote:
> > > That would make sense. The thread calls pk_backend_finished and we
> > > then try to unload the module as the thread is still running.
> > >
> > > Surely we can fix this simply by just causing the unload to wait for
> > > say one second (after getting ::finished) in the backend code, surely
> > > enough time to finish the thread and exit.
> >
> > Ew... not a fan of that. I can see various ways to solve this more
> > cleanly, mainly with things like having a list of threads "associated"
> > with each backend, providing a function to use to wrap g_thread_create
> > that adds threads to the "associated" list and doing a bunch of
> > g_thread_join's before unloading modules.
> Yes, this is a very good idea. We can abstract this nicely with a
> pk_backend_thread_create (PkBackend *backend, PkThreadFunc func)
> function, and then on backend unload we go through the list and join
> the threads.

What about something like the attached patch?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: moo.patch
Type: text/x-patch
Size: 8032 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20070914/a2f03b75/attachment-0004.bin>

More information about the PackageKit mailing list