Acquire/release a POSIX file lock on repository archives.
- xbps_repo_open() accepts a third argument (bool) to acquire a POSIX file lock on the repository archive. - xbps_repo_close() accepts a second argument (bool) to release a POSIX file lock on the repository archive. This avoids the issue of multiple xbps-rindex(8) processes being blocked even for different repositories on the same architecture, resulting in unnecessary contention.
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
*
|
||||
* This header documents the full API for the XBPS Library.
|
||||
*/
|
||||
#define XBPS_API_VERSION "20140812"
|
||||
#define XBPS_API_VERSION "20140905"
|
||||
|
||||
#ifndef XBPS_VERSION
|
||||
#define XBPS_VERSION "UNSET"
|
||||
@@ -1245,6 +1245,10 @@ struct xbps_repo {
|
||||
* URI string associated with repository.
|
||||
*/
|
||||
const char *uri;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
int fd;
|
||||
/**
|
||||
* var is_remote
|
||||
*
|
||||
@@ -1372,17 +1376,19 @@ xbps_dictionary_t xbps_rpool_get_pkg_plist(struct xbps_handle *xhp,
|
||||
*
|
||||
* @param[in] xhp Pointer to the xbps_handle struct.
|
||||
* @param[in] uri Repository URI to match.
|
||||
* @param[in] lock Set it to true to acquire a POSIX file lock.
|
||||
*
|
||||
* @return The matching repository object, NULL otherwise.
|
||||
*/
|
||||
struct xbps_repo *xbps_repo_open(struct xbps_handle *xhp, const char *url);
|
||||
struct xbps_repo *xbps_repo_open(struct xbps_handle *xhp, const char *url, bool lock);
|
||||
|
||||
/**
|
||||
* Closes a repository object and releases resources.
|
||||
*
|
||||
* @param[in] repo The repository object to close.
|
||||
* @param[in] lock Set it to true to release the POSIX file lock.
|
||||
*/
|
||||
void xbps_repo_close(struct xbps_repo *repo);
|
||||
void xbps_repo_close(struct xbps_repo *repo, bool lock);
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user