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:
Juan RP
2014-09-05 12:26:42 +02:00
parent 551555690d
commit 013731c502
13 changed files with 70 additions and 174 deletions

View File

@@ -66,7 +66,6 @@
#endif
#define _XBPS_RINDEX "xbps-rindex"
#define _XBPS_RINDEX_SEMNAME "/xbps-rindex-write"
/* From index-add.c */
int index_add(struct xbps_handle *, int, char **, bool);
@@ -85,13 +84,4 @@ int sign_repo(struct xbps_handle *, const char *, const char *,
bool repodata_flush(struct xbps_handle *, const char *,
xbps_dictionary_t, xbps_dictionary_t, xbps_dictionary_t);
struct idxlock {
sem_t *sem;
char *semname;
};
/* From sem.c */
struct idxlock *index_lock(struct xbps_handle *);
void index_unlock(struct idxlock *);
#endif /* !_XBPS_RINDEX_DEFS_H_ */