[patch] Make APM and PMU poll like acpi does

Sjoerd Simons sjoerd at luon.net
Tue Mar 8 02:28:46 PST 2005


On Mon, Mar 07, 2005 at 11:37:24AM -0500, David Zeuthen wrote:
> On Mon, 2005-03-07 at 11:28 +0100, Sjoerd Simons wrote:
> >Why are you using one poll function that searches the complete gdl for the
> >right objects each time ? Just adding a timeout for each object when it's added 
> >and removing that when the object is removed seems cleaner to me.
> 
> Then you can get into all sorts of interesting races if the HalDevice
> object is removed (which is probably never is for PMU but you get the
> point). It's also more code and more accounting. 

It's actually less code. But the problem is a hal device currently doesn't have
a removed signal. If it would have that then the following pseudo code would 
be enough: 

id = g_timeout_add(PMU_TIMEOUT, pmu_rescan, device);
g_signal_connect(device, "removed", device_remove_timeout, GOINT_TO_POINTER(id))

Where device_remove_timeout just does g_source_remove with the passed id.

> Something to optimize for later I guess unless you got a patch handy?

No sorry.. I'm currently swamped, hopefully i'll have the time to starting
playing with stuff again after my exams..

  Sjoerd
-- 
Mathematics deals exclusively with the relations of concepts
to each other without consideration of their relation to experience.
		-- Albert Einstein
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list