* lzms_range_encoder_raw. */
struct lzms_range_encoder_raw *rc;
- /* Bits recently encoded by this range encoder. This are used as in
+ /* Bits recently encoded by this range encoder. This is used as an
* index into @prob_entries. */
u32 state;
static void
lzms_init_rc_costs(void)
{
- static bool done = false;
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
- if (unlikely(!done)) {
- pthread_mutex_lock(&mutex);
- if (!done) {
- lzms_do_init_rc_costs();
- done = true;
- }
- pthread_mutex_unlock(&mutex);
- }
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+ pthread_once(&once, lzms_do_init_rc_costs);
}
/*