git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jak@xxxxxxxxxx: Frontend locking in APT clients]


On Mon, Jun 18, 2018 at 08:58:50PM -0400, Philipp Kern wrote:
> On 2018-06-18 14:20, Julian Andres Klode wrote:
> > Basically, add Depends: python-apt (>> 1.7~alpha1~), and do:
> >   with apt_pkg.SystemLock():
> >     main()
> 
> Will this also allow to wait on the lock?

No. mvo pushed https://salsa.debian.org/apt-team/apt/merge_requests/6
to implement waiting (in the src:apt frontends), but that's just
busy waiting.

For our own frontends like that we could implement non-busy waiting
using LOCK_EX without LOCK_NB and setting a SIGALRM to cancel the
lock attempt after a timeout[1]. I don't really think that's reasonable
for a library to do, though.

[1] Compare https://code.launchpad.net/~juliank/apport/lp1746874/+merge/337558
    for the idea
-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en