-
Thomas Haller authored
Usually, after g_pointer_bit_lock() we want to read the pointer that we have. In many cases, when we g_pointer_bit_lock() a pointer, we can access it afterwards without atomic, as nobody is going to modify the pointer then. However, gdataset also supports g_datalist_set_flags(), so the pointer may change at any time and we must always use atomics to read it. For that reason, g_datalist_lock_and_get() does an atomic read right after g_pointer_bit_lock(). g_pointer_bit_lock() can easily access the value that it just set. Add g_pointer_bit_lock_and_get() which can return the value that gets set afterwards. Aside from saving the second atomic-get in certain scenarios, the returned value is also atomically the one that we just set.
5609370d
Loading