Use a POSIX lock for pkgdb and only issue pkgdb writes in exact points.

- Rather than using a POSIX named semaphore use a POSIX lock (lockf(3))
for pkgdb for writers. Writers that cannot acquire the pkgdb lock will
get EAGAIN rather then being blocked.

- Due to using a file lock we cannot write the pkgdb every time a package
is being unpacked, configured or removed. Instead pkgdb is only written
at the end of a specific point in the transaction (unpack, configure, remove)
or via xbps_pkgdb_unlock().
This commit is contained in:
Juan RP
2014-03-04 14:37:10 +01:00
parent 6335573180
commit 0416b067d0
11 changed files with 85 additions and 101 deletions

View File

@ -370,11 +370,7 @@ purge:
* Unregister package from pkgdb.
*/
xbps_dictionary_remove(xhp->pkgdb, pkgname);
if ((rv = xbps_pkgdb_update(xhp, true)) != 0)
goto out;
xbps_dbg_printf(xhp, "[remove] unregister %s returned %d\n", pkgver, rv);
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_DONE, 0, pkgver, NULL);
out:
if (pkgname != NULL)