new locking API

Kevin Ottens ervin at kde.org
Tue Mar 27 10:00:11 PDT 2007


Le Mardi 27 Mars 2007, David Zeuthen a écrit :
> On Mon, 2007-03-26 at 21:44 +0200, Kevin Ottens wrote:
> > I've one question, why locking per interface? Why not locking per device?
> > It's not exactly obvious for me, I would feel natural to lock a device.
>
> Because one device object might have several interfaces and on one
> system you may see
>
>  device object A
>   implements interface Foo
>   implements interface Bar
>
> while another system shows
>
>  device object A
>   implements interface Foo
>
>  device object B
>   implements interface Bar

Yeah, I know that we can encounter those two cases.

> depending on many factors including how the interfaces are implemented
> and so on. So if the lock affected the entire device object you would
> have weird side effects because now you've rendered the Bar interface
> inoperable while you only really intended to lock Foo.

Ok, maybe that's just me being paranoid here. But depending how a device is 
done, aren't we at risk if we lock it only partly, two interfaces could be 
non orthogonal in their behavior.

Actually could be the case already with Volume.Crypto and Volume. If I lock 
the Volume interface I have to check each time if it also implements the 
Volume.Crypto interface to lock it too. Otherwise, one could perfectly call 
Teardown on it despite the lock on the Volume interface. A good way to shoot 
easily in your own foot IMO.

Regards.
-- 
Kévin 'ervin' Ottens, http://ervin.ipsquad.net
"Ni le maître sans disciple, Ni le disciple sans maître,
Ne font reculer l'ignorance."



More information about the hal mailing list