mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-06 17:18:25 +03:00
Merge pull request #1968 from ptomato/ostree-async-progress-copy-state
libostree: Add ostree_async_progress_copy_state()
This commit is contained in:
commit
7a7838b7a7
@ -3,6 +3,7 @@
|
|||||||
OstreeAsyncProgress
|
OstreeAsyncProgress
|
||||||
ostree_async_progress_new
|
ostree_async_progress_new
|
||||||
ostree_async_progress_new_and_connect
|
ostree_async_progress_new_and_connect
|
||||||
|
ostree_async_progress_copy_state
|
||||||
ostree_async_progress_get_status
|
ostree_async_progress_get_status
|
||||||
ostree_async_progress_get
|
ostree_async_progress_get
|
||||||
ostree_async_progress_get_variant
|
ostree_async_progress_get_variant
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
***/
|
***/
|
||||||
|
|
||||||
/* Add new symbols here. Release commits should copy this section into -released.sym. */
|
/* Add new symbols here. Release commits should copy this section into -released.sym. */
|
||||||
LIBOSTREE_2019.5 {
|
LIBOSTREE_2019.6 {
|
||||||
|
ostree_async_progress_copy_state;
|
||||||
} LIBOSTREE_2019.4;
|
} LIBOSTREE_2019.4;
|
||||||
|
|
||||||
/* Stub section for the stable release *after* this development one; don't
|
/* Stub section for the stable release *after* this development one; don't
|
||||||
|
@ -424,6 +424,40 @@ ostree_async_progress_set_uint64 (OstreeAsyncProgress *self,
|
|||||||
ostree_async_progress_set_variant (self, key, g_variant_new_uint64 (value));
|
ostree_async_progress_set_variant (self, key, g_variant_new_uint64 (value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_async_progress_copy_state:
|
||||||
|
* @self: An #OstreeAsyncProgress to copy from
|
||||||
|
* @dest: An #OstreeAsyncProgress to copy to
|
||||||
|
*
|
||||||
|
* Atomically copies all the state from @self to @dest, without invoking the
|
||||||
|
* callback.
|
||||||
|
* This is used for proxying progress objects across different #GMainContexts.
|
||||||
|
*
|
||||||
|
* Since: 2019.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ostree_async_progress_copy_state (OstreeAsyncProgress *self,
|
||||||
|
OstreeAsyncProgress *dest)
|
||||||
|
{
|
||||||
|
g_return_if_fail (OSTREE_IS_ASYNC_PROGRESS (self));
|
||||||
|
g_return_if_fail (OSTREE_IS_ASYNC_PROGRESS (dest));
|
||||||
|
|
||||||
|
g_mutex_lock (&self->lock);
|
||||||
|
|
||||||
|
if (self->dead)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
GLNX_HASH_TABLE_FOREACH_KV (self->values, void *, key, GVariant *, value)
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
g_variant_ref (value);
|
||||||
|
g_hash_table_replace (dest->values, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
g_mutex_unlock (&self->lock);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ostree_async_progress_new:
|
* ostree_async_progress_new:
|
||||||
*
|
*
|
||||||
|
@ -92,4 +92,8 @@ void ostree_async_progress_set_variant (OstreeAsyncProgress *self,
|
|||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
void ostree_async_progress_finish (OstreeAsyncProgress *self);
|
void ostree_async_progress_finish (OstreeAsyncProgress *self);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
void ostree_async_progress_copy_state (OstreeAsyncProgress *self,
|
||||||
|
OstreeAsyncProgress *dest);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Loading…
Reference in New Issue
Block a user