ZifLock

ZifLock — Generic object to lock the package system.

Synopsis

#define             ZIF_LOCK_ERROR
                    ZifLock;
                    ZifLockPrivate;
                    ZifLockClass;
enum                ZifLockError;
GQuark              zif_lock_error_quark                (void);
ZifLock *           zif_lock_new                        (void);
gboolean            zif_lock_is_locked                  (ZifLock *lock,
                                                         guint *pid);
gboolean            zif_lock_set_locked                 (ZifLock *lock,
                                                         guint *pid,
                                                         GError **error);
gboolean            zif_lock_set_unlocked               (ZifLock *lock,
                                                         GError **error);

Object Hierarchy

  GObject
   +----ZifLock

Description

This object works with the generic lock file.

Details

ZIF_LOCK_ERROR

#define ZIF_LOCK_ERROR		(zif_lock_error_quark ())


ZifLock

typedef struct _ZifLock ZifLock;


ZifLockPrivate

typedef struct _ZifLockPrivate ZifLockPrivate;

Private ZifLock data


ZifLockClass

typedef struct {
	GObjectClass parent_class;
} ZifLockClass;


enum ZifLockError

typedef enum {
	ZIF_LOCK_ERROR_FAILED,
	ZIF_LOCK_ERROR_ALREADY_LOCKED,
	ZIF_LOCK_ERROR_NOT_LOCKED,
	ZIF_LOCK_ERROR_LAST
} ZifLockError;


zif_lock_error_quark ()

GQuark              zif_lock_error_quark                (void);

Returns :

Our personal error quark.

Since 0.1.0


zif_lock_new ()

ZifLock *           zif_lock_new                        (void);

Returns :

A new lock class instance.

Since 0.1.0


zif_lock_is_locked ()

gboolean            zif_lock_is_locked                  (ZifLock *lock,
                                                         guint *pid);

Gets the lock state.

lock :

the ZifLock object

pid :

the PID of the process holding the lock, or NULL

Returns :

TRUE if we are already locked

Since 0.1.0


zif_lock_set_locked ()

gboolean            zif_lock_set_locked                 (ZifLock *lock,
                                                         guint *pid,
                                                         GError **error);

Tries to lock the packaging system.

lock :

the ZifLock object

pid :

the PID of the process holding the lock, or NULL

error :

a GError which is used on failure, or NULL

Returns :

TRUE if we locked, else FALSE and the error is set

Since 0.1.0


zif_lock_set_unlocked ()

gboolean            zif_lock_set_unlocked               (ZifLock *lock,
                                                         GError **error);

Unlocks the packaging system.

lock :

the ZifLock object

error :

a GError which is used on failure, or NULL

Returns :

TRUE for success, FALSE for failure

Since 0.1.0