summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-21 04:55:41 +0200
committerDudemanguy <random342@airmail.cc>2023-11-05 17:36:17 +0000
commit174df99ffa53f1091589eaa4fa0c16cdd55a9326 (patch)
tree3a60d45615f18beed98a9b08267c28ed7e05dd5f /options
parent3a8b107f6216b38a151d5ca1e9d4f2727e3418f5 (diff)
downloadmpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.bz2
mpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.xz
ALL: use new mp_thread abstraction
Diffstat (limited to 'options')
-rw-r--r--options/m_config_core.c34
-rw-r--r--options/m_config_frontend.c10
2 files changed, 22 insertions, 22 deletions
diff --git a/options/m_config_core.c b/options/m_config_core.c
index 4e488ca01d..08a76eb76d 100644
--- a/options/m_config_core.c
+++ b/options/m_config_core.c
@@ -17,7 +17,6 @@
#include <assert.h>
#include <errno.h>
-#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
@@ -25,17 +24,18 @@
#include <string.h>
#include <strings.h>
-#include "m_config_core.h"
-#include "options/m_option.h"
#include "common/common.h"
#include "common/global.h"
-#include "common/msg.h"
#include "common/msg_control.h"
+#include "common/msg.h"
+#include "m_config_core.h"
#include "misc/dispatch.h"
+#include "options/m_option.h"
+#include "osdep/threads.h"
// For use with m_config_cache.
struct m_config_shadow {
- pthread_mutex_t lock;
+ mp_mutex lock;
// Incremented on every option change.
_Atomic uint64_t ts;
// -- immutable after init
@@ -417,14 +417,14 @@ static void shadow_destroy(void *p)
assert(shadow->num_listeners == 0);
talloc_free(shadow->data);
- pthread_mutex_destroy(&shadow->lock);
+ mp_mutex_destroy(&shadow->lock);
}
struct m_config_shadow *m_config_shadow_new(const struct m_sub_options *root)
{
struct m_config_shadow *shadow = talloc_zero(NULL, struct m_config_shadow);
talloc_set_destructor(shadow, shadow_destroy);
- pthread_mutex_init(&shadow->lock, NULL);
+ mp_mutex_init(&shadow->lock);
add_sub_group(shadow, NULL, -1, -1, root);
@@ -566,9 +566,9 @@ struct m_config_cache *m_config_cache_from_shadow(void *ta_parent,
in->shadow = shadow;
in->src = shadow->data;
- pthread_mutex_lock(&shadow->lock);
+ mp_mutex_lock(&shadow->lock);
in->data = allocate_option_data(cache, shadow, group_index, in->src);
- pthread_mutex_unlock(&shadow->lock);
+ mp_mutex_unlock(&shadow->lock);
cache->opts = in->data->gdata[0].udata;
@@ -675,7 +675,7 @@ bool m_config_cache_update(struct m_config_cache *cache)
if (!cache_check_update(cache))
return false;
- pthread_mutex_lock(&shadow->lock);
+ mp_mutex_lock(&shadow->lock);
bool res = false;
while (1) {
void *p;
@@ -684,7 +684,7 @@ bool m_config_cache_update(struct m_config_cache *cache)
break;
res = true;
}
- pthread_mutex_unlock(&shadow->lock);
+ mp_mutex_unlock(&shadow->lock);
return res;
}
@@ -697,9 +697,9 @@ bool m_config_cache_get_next_changed(struct m_config_cache *cache, void **opt)
if (!cache_check_update(cache) && in->upd_group < 0)
return false;
- pthread_mutex_lock(&shadow->lock);
+ mp_mutex_lock(&shadow->lock);
update_next_option(cache, opt);
- pthread_mutex_unlock(&shadow->lock);
+ mp_mutex_unlock(&shadow->lock);
return !!*opt;
}
@@ -744,7 +744,7 @@ bool m_config_cache_write_opt(struct m_config_cache *cache, void *ptr)
struct m_config_group *g = &shadow->groups[group_idx];
const struct m_option *opt = &g->group->opts[opt_idx];
- pthread_mutex_lock(&shadow->lock);
+ mp_mutex_lock(&shadow->lock);
struct m_group_data *gdst = m_config_gdata(in->data, group_idx);
struct m_group_data *gsrc = m_config_gdata(in->src, group_idx);
@@ -763,7 +763,7 @@ bool m_config_cache_write_opt(struct m_config_cache *cache, void *ptr)
}
}
- pthread_mutex_unlock(&shadow->lock);
+ mp_mutex_unlock(&shadow->lock);
return changed;
}
@@ -774,7 +774,7 @@ void m_config_cache_set_wakeup_cb(struct m_config_cache *cache,
struct config_cache *in = cache->internal;
struct m_config_shadow *shadow = in->shadow;
- pthread_mutex_lock(&shadow->lock);
+ mp_mutex_lock(&shadow->lock);
if (in->in_list) {
for (int n = 0; n < shadow->num_listeners; n++) {
if (shadow->listeners[n] == in) {
@@ -796,7 +796,7 @@ void m_config_cache_set_wakeup_cb(struct m_config_cache *cache,
in->wakeup_cb = cb;
in->wakeup_cb_ctx = cb_ctx;
}
- pthread_mutex_unlock(&shadow->lock);
+ mp_mutex_unlock(&shadow->lock);
}
static void dispatch_notify(void *p)
diff --git a/options/m_config_frontend.c b/options/m_config_frontend.c
index e95b350849..9b5438926c 100644
--- a/options/m_config_frontend.c
+++ b/options/m_config_frontend.c
@@ -18,7 +18,6 @@
#include <assert.h>
#include <errno.h>
#include <float.h>
-#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
@@ -28,15 +27,16 @@
#include "libmpv/client.h"
-#include "m_config.h"
-#include "m_config_frontend.h"
-#include "options/m_option.h"
#include "common/common.h"
#include "common/global.h"
-#include "common/msg.h"
#include "common/msg_control.h"
+#include "common/msg.h"
+#include "m_config_frontend.h"
+#include "m_config.h"
#include "misc/dispatch.h"
#include "misc/node.h"
+#include "options/m_option.h"
+#include "osdep/threads.h"
extern const char mp_help_text[];