Skip to Content.
Sympa Menu

sm-sorcery - [SM-Sorcery] New liblock

sm-sorcery AT lists.ibiblio.org

Subject: Discussion of Sorcery related topics

List archive

Chronological Thread  
  • From: Benoit PAPILLAULT <benoit.papillault AT free.fr>
  • To: sm-sorcery AT lists.ibiblio.org
  • Cc: Sorcery Team Leader <sorcery AT sourcemage.org>
  • Subject: [SM-Sorcery] New liblock
  • Date: Tue, 4 Nov 2003 15:51:45 +0100

Hi there,

I discussed on irc with dufflebunk (the author of the current liblock) on
a way to enhanced it and give you here the result of my work.

The whole story began when running "summon bash" twice in parallel or when
playing with running "summon --all" in parallel. It seems that the
is_locked() function was not used correctly. So I make a patch that is now
applied to p4 (in sorcery devel). But I wanted to learn more and I feel
that something like trylock was missing.

So, I read the code from liblock and see that is_locked() was not what was
needed, since if you check for a lock and THEN lock it, you can end up
with two instances of summon trying to download the same file and one will
be blocked. summon was needing something like trylock_resources(). In this
case, if two instances of summon try to lock the same resource, one and
only one will succeed. The other will fails to lock and returns
immediately.

So, I rewrote the lock stuff from liblock. It is based on the assumption
that if two processes try to make a directory, one and only will succeed
and it will succeed immediately. I make further enhancement like removing
the need for "rm -rf /tmp/liblock-0" from time to time. All stale locks or
old locks are AUTOMATICALLY removed when needed (ie if you try to lock a
stale/old lock, ALL stale/old locks will be removed).

As, I am not part of the sorcery team, I made two patches (one for stable
sorcery, one for devel sorcery). Both of them have been tested by running
a "sorcery rebuild". I must say that this is the very first time where
"sorcery rebuild" succeeds in recompiling everything. Please test them.

Btw, I would like to know what is the process to make those patches
available in sorcery stable? (so that I can use it in the next ISO
release)

Patches are attached.

Benoit PAPILLAULT, ISO Guru

Attachment: sorcery-stable-liblock.patch
Description: Binary data

Attachment: sorcery-devel-liblock.patch
Description: Binary data



  • [SM-Sorcery] New liblock, Benoit PAPILLAULT, 11/04/2003

Archive powered by MHonArc 2.6.24.

Top of Page