dup_qdata


Description:

[ CCode ( simple_generics = true ) ]
[ Version ( since = "2.34" ) ]
public T dup_qdata<T> (Quark quark, DuplicateFunc<T> dup_func)

This is a variant of 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 this 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.

Parameters:

this

the Object to store user data on

quark

a Quark, naming the user data pointer

dup_func

function to dup the value

user_data

passed as user_data to dup_func

Returns:

the result of calling dup_func on the value associated with quark on this , or null if not set. If dup_func is null, the value is returned unmodified.




2022 vala-language.org