MT#61822 use MUTEX_STATIC_INIT

in a few places where it makes sense

Change-Id: Ie2b6308f5f33af9afe71584d710fd0116b17e865
pull/1897/head
Richard Fuchs 4 months ago
parent 3409752fe2
commit 175404f72c

@ -52,7 +52,7 @@ struct ipv6_ipt_entry {
};
static mutex_t __xt_lock;
static mutex_t __xt_lock = MUTEX_STATIC_INIT;
static int __xt_lock_fd = -1;
@ -327,7 +327,6 @@ void iptables_init(void) {
#ifdef WITH_IPTABLES_OPTION
mutex_init(&__xt_lock);
iptables_add_rule = __iptables_add_rule;
iptables_del_rule = __iptables_del_rule;

@ -58,7 +58,7 @@ TYPED_GHASHTABLE(janus_rooms_ht, uint64_t, struct janus_room, int64_hash, int64_
TYPED_GHASHTABLE(janus_tokens_ht, char, time_t, c_str_hash, c_str_equal, g_free, g_free)
static mutex_t janus_lock;
static mutex_t janus_lock = MUTEX_STATIC_INIT;
static janus_tokens_ht janus_tokens; // auth tokens, currently mostly unused
static janus_sessions_ht janus_sessions; // session ID -> session. holds a session reference
static janus_handles_ht janus_handles; // handle ID -> handle
@ -1974,7 +1974,6 @@ done:
void janus_init(void) {
mutex_init(&janus_lock);
janus_tokens = janus_tokens_ht_new();
janus_sessions = janus_sessions_ht_new();
janus_handles = janus_handles_ht_new();
@ -1982,7 +1981,6 @@ void janus_init(void) {
// XXX timer thread to clean up orphaned sessions
}
void janus_free(void) {
mutex_destroy(&janus_lock);
t_hash_table_destroy(janus_tokens);
t_hash_table_destroy(janus_sessions);
t_hash_table_destroy(janus_handles);

@ -82,7 +82,7 @@ struct media_player_cache_packet {
long long duration_ts;
};
static mutex_t media_player_cache_lock;
static mutex_t media_player_cache_lock = MUTEX_STATIC_INIT;
static GHashTable *media_player_cache; // keys and values only ever freed at shutdown
static bool media_player_read_packet(struct media_player *mp);
@ -1744,7 +1744,6 @@ void media_player_init(void) {
media_player_cache = g_hash_table_new_full(media_player_cache_entry_hash,
media_player_cache_entry_eq, media_player_cache_index_free,
media_player_cache_entry_free);
mutex_init(&media_player_cache_lock);
}
timerthread_init(&media_player_thread, rtpe_config.media_num_threads, media_player_run);
@ -1756,10 +1755,8 @@ void media_player_free(void) {
#ifdef WITH_TRANSCODING
timerthread_free(&media_player_thread);
if (media_player_cache) {
mutex_destroy(&media_player_cache_lock);
if (media_player_cache)
g_hash_table_destroy(media_player_cache);
}
#endif
timerthread_free(&send_timer_thread);
}

Loading…
Cancel
Save