Re: Why does yum always need a global lock?

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

 



ok, that sounds like some motivation for me do to it. 

I've had a quick look over the source code and could not yet figure out,
which functions really modify stuff in /var/cache/yum, but at a first
glance it seem to be a few. You do not have a list of them flying
around, don't you? ;)

My approach would be to create a decorator (called @needslock or
something) and add it to every function that needs it. That decorator
would look like the one in the attachment.
Is that the yum-way fo doing it?

regards

Christoph


def needsLock(base, logger):
	def waitLock():
		while True:
			try:
				base.doLock()
			except Errors.LockError, e:
				if "%s" %(e.msg,) != lockerr:
					lockerr = "%s" %(e.msg,)
					logger.critical(lockerr)
				logger.critical(_("Another app is currently holding the yum lock; waiting for it to exit..."))
				time.sleep(2)
			else:
				break


	def lockFun(f):
		def newFun(*args, **kw):
			waitLock()
			return f(*args, **kw)	
		return newFun
	return countFun

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux