[atomic-ptr] Rename get

This commit is contained in:
Behdad Esfahbod 2022-08-03 12:43:28 -06:00
parent d3f2287e0b
commit 86d1e22d4f
6 changed files with 13 additions and 13 deletions

View File

@ -180,11 +180,11 @@ struct hb_atomic_ptr_t
void init (T* v_ = nullptr) { set_relaxed (v_); }
void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); }
T *get_relaxed () const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); }
T *get () const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
T *get_acquire () const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); }
T * operator -> () const { return get (); }
template <typename C> operator C * () const { return get (); }
T * operator -> () const { return get_acquire (); }
template <typename C> operator C * () const { return get_acquire (); }
T *v = nullptr;
};

View File

@ -176,12 +176,12 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
void init0 () {} /* Init, when memory is already set to 0. No-op for us. */
void init () { instance.set_relaxed (nullptr); }
void fini () { do_destroy (instance.get ()); init (); }
void fini () { do_destroy (instance.get_acquire ()); init (); }
void free_instance ()
{
retry:
Stored *p = instance.get ();
Stored *p = instance.get_acquire ();
if (unlikely (p && !cmpexch (p, nullptr)))
goto retry;
do_destroy (p);
@ -203,7 +203,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
Stored * get_stored () const
{
retry:
Stored *p = this->instance.get ();
Stored *p = this->instance.get_acquire ();
if (unlikely (!p))
{
if (unlikely (this->is_inert ()))

View File

@ -281,7 +281,7 @@ template <typename Type>
static inline void hb_object_fini (Type *obj)
{
obj->header.ref_count.fini (); /* Do this before user_data */
hb_user_data_array_t *user_data = obj->header.user_data.get ();
hb_user_data_array_t *user_data = obj->header.user_data.get_acquire ();
if (user_data)
{
user_data->fini ();
@ -301,7 +301,7 @@ static inline bool hb_object_set_user_data (Type *obj,
assert (hb_object_is_valid (obj));
retry:
hb_user_data_array_t *user_data = obj->header.user_data.get ();
hb_user_data_array_t *user_data = obj->header.user_data.get_acquire ();
if (unlikely (!user_data))
{
user_data = (hb_user_data_array_t *) hb_calloc (sizeof (hb_user_data_array_t), 1);
@ -326,7 +326,7 @@ static inline void *hb_object_get_user_data (Type *obj,
if (unlikely (!obj || obj->header.is_inert ()))
return nullptr;
assert (hb_object_is_valid (obj));
hb_user_data_array_t *user_data = obj->header.user_data.get ();
hb_user_data_array_t *user_data = obj->header.user_data.get_acquire ();
if (!user_data)
return nullptr;
return user_data->get (key);

View File

@ -1379,7 +1379,7 @@ struct cff1
if (unlikely (!len)) return false;
retry:
hb_sorted_vector_t<gname_t> *names = glyph_names.get ();
hb_sorted_vector_t<gname_t> *names = glyph_names.get_acquire ();
if (unlikely (!names))
{
names = (hb_sorted_vector_t<gname_t> *) hb_calloc (sizeof (hb_sorted_vector_t<gname_t>), 1);

View File

@ -165,7 +165,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
if (use_cache)
{
retry:
cache = ot_font->advance_cache.get ();
cache = ot_font->advance_cache.get_acquire ();
if (unlikely (!cache))
{
cache = (hb_advance_cache_t *) hb_malloc (sizeof (hb_advance_cache_t));

View File

@ -133,7 +133,7 @@ struct post
}
~accelerator_t ()
{
hb_free (gids_sorted_by_name.get ());
hb_free (gids_sorted_by_name.get_acquire ());
table.destroy ();
}
@ -160,7 +160,7 @@ struct post
if (unlikely (!len)) return false;
retry:
uint16_t *gids = gids_sorted_by_name.get ();
uint16_t *gids = gids_sorted_by_name.get_acquire ();
if (unlikely (!gids))
{