Remove hb_static_threadsafe_set_t
This commit is contained in:
parent
e06d4eda7b
commit
389a7c9e67
|
@ -162,7 +162,8 @@ struct hb_language_item_t {
|
|||
void finish (void) { free (lang); }
|
||||
};
|
||||
|
||||
static hb_static_threadsafe_set_t<hb_language_item_t> langs;
|
||||
static hb_static_mutex_t langs_lock;
|
||||
static hb_lockable_set_t<hb_language_item_t, hb_static_mutex_t> langs;
|
||||
|
||||
hb_language_t
|
||||
hb_language_from_string (const char *str)
|
||||
|
@ -170,7 +171,7 @@ hb_language_from_string (const char *str)
|
|||
if (!str || !*str)
|
||||
return NULL;
|
||||
|
||||
hb_language_item_t *item = langs.find_or_insert (str);
|
||||
hb_language_item_t *item = langs.find_or_insert (str, langs_lock);
|
||||
|
||||
return likely (item) ? item->lang : NULL;
|
||||
}
|
||||
|
|
|
@ -107,48 +107,6 @@ struct hb_static_mutex_t : hb_mutex_t
|
|||
};
|
||||
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
||||
template <typename item_t>
|
||||
struct hb_static_threadsafe_set_t
|
||||
{
|
||||
hb_lockable_set_t <item_t, hb_static_mutex_t> set;
|
||||
hb_static_mutex_t lock;
|
||||
|
||||
template <typename T>
|
||||
inline item_t *replace_or_insert (T v)
|
||||
{
|
||||
return set.replace_or_insert (v, lock);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void remove (T v)
|
||||
{
|
||||
set.remove (v, lock);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool find (T v, item_t *i)
|
||||
{
|
||||
return set.find (v, i, lock);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline item_t *find_or_insert (T v)
|
||||
{
|
||||
return set.find_or_insert (v, lock);
|
||||
}
|
||||
|
||||
void finish (void)
|
||||
{
|
||||
set.finish (lock);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
HB_BEGIN_DECLS
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
#endif /* HB_MUTEX_PRIVATE_HH */
|
||||
|
|
Loading…
Reference in New Issue