repo: Require lock type in ostree_repo_lock_pop

This simplifies the lock state management considerably since the
previously pushed type doesn't need to be tracked. Instead, 2 counters
are kept to track how many times each lock type has been pushed. When
the number of exclusive locks drops to 0, the lock transitions back to
shared.
This commit is contained in:
Dan Nicholson committed 2021-06-05 09:07:39 -06:00
1 parent 0f36d8c221
commit c3ada6fa7a
4 files changed
+132 -71

No files matched your search

+5 -4
View File
@@ -1519,9 +1519,10 @@ gboolean ostree_repo_lock_push (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_repo_lock_pop (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_lock_pop (OstreeRepo *self,
OstreeRepoLockType lock_type,
GCancellable *cancellable,
GError **error);
/* C convenience API only */
#ifndef __GI_SCANNER__
@@ -1533,7 +1534,7 @@ gboolean ostree_repo_lock_pop (OstreeRepo *self,
*
* Since: 2021.3
*/
typedef OstreeRepo OstreeRepoAutoLock;
typedef struct OstreeRepoAutoLock OstreeRepoAutoLock;
_OSTREE_PUBLIC
OstreeRepoAutoLock * ostree_repo_auto_lock_push (OstreeRepo *self,