diff options
Diffstat (limited to 'gir/gobject-2.0.c')
-rw-r--r-- | gir/gobject-2.0.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/gir/gobject-2.0.c b/gir/gobject-2.0.c index 36064b1a..2c1ae39e 100644 --- a/gir/gobject-2.0.c +++ b/gir/gobject-2.0.c @@ -2007,6 +2007,60 @@ /** + * g_object_dup_data: + * @object: the #GObject to store user data on + * @key: a string, naming the user data pointer + * @dup_func: (allow-none): function to dup the value + * @user_data: (allow-none): passed as user_data to @dup_func + * + * This is a variant of g_object_get_data() which returns + * a 'duplicate' of the value. @dup_func defines the + * meaning of 'duplicate' in this context, it could e.g. + * take a reference on a ref-counted object. + * + * If the @key is not set on the object then @dup_func + * will be called with a %NULL argument. + * + * Note that @dup_func is called while user data of @object + * is locked. + * + * This function can be useful to avoid races when multiple + * threads are using object data on the same key on the same + * object. + * + * Returns: the result of calling @dup_func on the value associated with @key on @object, or %NULL if not set. If @dup_func is %NULL, the value is returned unmodified. + * Since: 2.34 + */ + + +/** + * g_object_dup_qdata: + * @object: the #GObject to store user data on + * @quark: a #GQuark, naming the user data pointer + * @dup_func: (allow-none): function to dup the value + * @user_data: (allow-none): passed as user_data to @dup_func + * + * This is a variant of g_object_get_qdata() which returns + * a 'duplicate' of the value. @dup_func defines the + * meaning of 'duplicate' in this context, it could e.g. + * take a reference on a ref-counted object. + * + * If the @quark is not set on the object then @dup_func + * will be called with a %NULL argument. + * + * Note that @dup_func is called while user data of @object + * is locked. + * + * This function can be useful to avoid races when multiple + * threads are using object data on the same key on the same + * object. + * + * Returns: the result of calling @dup_func on the value associated with @quark on @object, or %NULL if not set. If @dup_func is %NULL, the value is returned unmodified. + * Since: 2.34 + */ + + +/** * g_object_force_floating: * @object: a #GObject * @@ -2358,6 +2412,66 @@ /** + * g_object_replace_data: + * @object: the #GObject to store user data on + * @key: a string, naming the user data pointer + * @oldval: (allow-none): the old value to compare against + * @newval: (allow-none): the new value + * @destroy: (allow-none): a destroy notify for the new value + * @old_destroy: (allow-none): destroy notify for the existing value + * + * Compares the user data for the key @key on @object with + * @oldval, and if they are the same, replaces @oldval with + * @newval. + * + * This is like a typical atomic compare-and-exchange + * operation, for user data on an object. + * + * If the previous value was replaced then ownership of the + * old value (@oldval) is passed to the caller, including + * the registred destroy notify for it (passed out in @old_destroy). + * Its up to the caller to free this as he wishes, which may + * or may not include using @old_destroy as sometimes replacement + * should not destroy the object in the normal way. + * + * Return: %TRUE if the existing value for @key was replaced + * by @newval, %FALSE otherwise. + * + * Since: 2.34 + */ + + +/** + * g_object_replace_qdata: + * @object: the #GObject to store user data on + * @quark: a #GQuark, naming the user data pointer + * @oldval: (allow-none): the old value to compare against + * @newval: (allow-none): the new value + * @destroy: (allow-none): a destroy notify for the new value + * @old_destroy: (allow-none): destroy notify for the existing value + * + * Compares the user data for the key @quark on @object with + * @oldval, and if they are the same, replaces @oldval with + * @newval. + * + * This is like a typical atomic compare-and-exchange + * operation, for user data on an object. + * + * If the previous value was replaced then ownership of the + * old value (@oldval) is passed to the caller, including + * the registred destroy notify for it (passed out in @old_destroy). + * Its up to the caller to free this as he wishes, which may + * or may not include using @old_destroy as sometimes replacement + * should not destroy the object in the normal way. + * + * Return: %TRUE if the existing value for @quark was replaced + * by @newval, %FALSE otherwise. + * + * Since: 2.34 + */ + + +/** * g_object_run_dispose: * @object: a #GObject * |