| ZIF Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#define ZIF_LOCK_ERROR struct ZifLock; struct ZifLockClass; enum ZifLockError; enum ZifLockType; GQuark zif_lock_error_quark (void); gboolean zif_lock_is_instance_valid (void); gboolean zif_lock_is_locked (ZifLock *lock,guint *pid); ZifLock * zif_lock_new (void); gboolean zif_lock_release (ZifLock *lock,ZifLockType type,GError **error); gboolean zif_lock_set_locked (ZifLock *lock,guint *pid,GError **error); gboolean zif_lock_set_unlocked (ZifLock *lock,GError **error); gboolean zif_lock_take (ZifLock *lock,ZifLockType type,GError **error); const gchar * zif_lock_type_to_string (ZifLockType lock_type);
typedef enum {
ZIF_LOCK_ERROR_FAILED,
ZIF_LOCK_ERROR_ALREADY_LOCKED,
ZIF_LOCK_ERROR_NOT_LOCKED,
ZIF_LOCK_ERROR_PERMISSION,
ZIF_LOCK_ERROR_LAST
} ZifLockError;
typedef enum {
ZIF_LOCK_TYPE_RPMDB_WRITE,
ZIF_LOCK_TYPE_REPO_WRITE,
ZIF_LOCK_TYPE_METADATA_WRITE,
ZIF_LOCK_TYPE_LAST
} ZifLockType;
gboolean zif_lock_is_instance_valid (void);
Returns : |
TRUE if a singleton instance already exists |
Since 0.1.6
gboolean zif_lock_is_locked (ZifLock *lock,guint *pid);
Gets the lock state.
This function is DEPRECATED as it's not threadsafe.
|
A ZifLock |
|
The PID of the process holding the lock, or NULL
|
Returns : |
TRUE if we are already locked |
Since 0.1.0
gboolean zif_lock_release (ZifLock *lock,ZifLockType type,GError **error);
Tries to release a lock for the packaging system.
|
A ZifLock |
|
A ZifLockType, e.g. ZIF_LOCK_TYPE_RPMDB_WRITE
|
|
A GError, or NULL
|
Returns : |
TRUE if we locked, else FALSE and the error is set |
Since 0.1.6
gboolean zif_lock_set_locked (ZifLock *lock,guint *pid,GError **error);
Tries to lock the packaging system.
This function is DEPRECATED. Use zif_lock_take() instead.
|
A ZifLock |
|
A PID of the process holding the lock, or NULL
|
|
A GError, or NULL
|
Returns : |
TRUE if we locked, else FALSE and the error is set |
Since 0.1.0
gboolean zif_lock_set_unlocked (ZifLock *lock,GError **error);
Unlocks the packaging system.
This function is DEPRECATED. Use zif_lock_take() instead.
Since 0.1.0
gboolean zif_lock_take (ZifLock *lock,ZifLockType type,GError **error);
Tries to take a lock for the packaging system.
|
A ZifLock |
|
A ZifLockType, e.g. ZIF_LOCK_TYPE_RPMDB_WRITE
|
|
A GError, or NULL
|
Returns : |
TRUE if we locked, else FALSE and the error is set |
Since 0.1.6
const gchar * zif_lock_type_to_string (ZifLockType lock_type);
Returns : |
The string representation of the type |
Since 0.1.6