Commit afac3d3f authored by Derek Buitenhuis's avatar Derek Buitenhuis

API: Run dav1d_init under pthread_once

This makes the function thread safe, to call, for example,
from multiple transient dependecies or threads.
Signed-off-by: Derek Buitenhuis's avatarDerek Buitenhuis <>
parent a6853a94
...@@ -45,12 +45,18 @@ ...@@ -45,12 +45,18 @@
#include "src/thread_task.h" #include "src/thread_task.h"
#include "src/wedge.h" #include "src/wedge.h"
void dav1d_init(void) { static void init_internal(void) {
av1_init_wedge_masks(); av1_init_wedge_masks();
av1_init_interintra_masks(); av1_init_interintra_masks();
av1_init_qm_tables(); av1_init_qm_tables();
} }
static pthread_once_t initted = PTHREAD_ONCE_INIT;
void dav1d_init(void) {
pthread_once(&initted, init_internal);
const char *dav1d_version(void) { const char *dav1d_version(void) {
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment