ZIF Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
#define ZIF_LOCK_ERROR struct ZifLock; struct ZifLockClass; enum ZifLockError; enum ZifLockType; enum ZifLockMode; GQuark zif_lock_error_quark (void
); ZifLock * zif_lock_new (void
); gboolean zif_lock_is_instance_valid (void
); guint zif_lock_take (ZifLock *lock
,ZifLockType type
,ZifLockMode mode
,GError **error
); gboolean zif_lock_release (ZifLock *lock
,guint id
,GError **error
); void zif_lock_release_noerror (ZifLock *lock
,guint id
); const gchar * zif_lock_type_to_string (ZifLockType lock_type
); guint zif_lock_get_state (ZifLock *lock
);
struct ZifLockClass { GObjectClass parent_class; /* Signals */ void (* state_changed) (ZifLock *lock, guint state_bitfield); /* Padding for future expansion */ void (*_zif_reserved1) (void); void (*_zif_reserved2) (void); void (*_zif_reserved3) (void); void (*_zif_reserved4) (void); };
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, ZIF_LOCK_TYPE_REPO, ZIF_LOCK_TYPE_METADATA, ZIF_LOCK_TYPE_GROUPS, ZIF_LOCK_TYPE_RELEASE, ZIF_LOCK_TYPE_CONFIG, ZIF_LOCK_TYPE_HISTORY, ZIF_LOCK_TYPE_LAST } ZifLockType;
typedef enum { ZIF_LOCK_MODE_THREAD, ZIF_LOCK_MODE_PROCESS, ZIF_LOCK_MODE_LAST } ZifLockMode;
gboolean zif_lock_is_instance_valid (void
);
Returns : |
TRUE if a singleton instance already exists |
Since 0.1.6
guint zif_lock_take (ZifLock *lock
,ZifLockType type
,ZifLockMode mode
,GError **error
);
Tries to take a lock for the packaging system.
|
A ZifLock |
|
A ZifLockType, e.g. ZIF_LOCK_TYPE_RPMDB
|
|
A ZifLockMode, e.g. ZIF_LOCK_MODE_PROCESS
|
|
A GError, or NULL
|
Returns : |
A lock ID greater than 0, or 0 for an error. |
Since 0.3.1
gboolean zif_lock_release (ZifLock *lock
,guint id
,GError **error
);
Tries to release a lock for the packaging system.
|
A ZifLock |
|
A lock ID, as given by zif_lock_take()
|
|
A GError, or NULL
|
Returns : |
TRUE if we locked, else FALSE and the error is set |
Since 0.3.1
void zif_lock_release_noerror (ZifLock *lock
,guint id
);
Tries to release a lock for the packaging system. This method should not be used lightly as no error will be returned.
|
A ZifLock |
|
A lock ID, as given by zif_lock_take()
|
Since 0.3.1
const gchar * zif_lock_type_to_string (ZifLockType lock_type
);
Returns : |
The string representation of the type |
Since 0.1.6