Skip to content
Snippets Groups Projects

Draft: pl_thread: add PL_THREAD_REALTIME

Open Niklas Haas requested to merge haasn/libplacebo:thread_rt into master
1 unresolved thread
5 files
+ 45
6
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 18
3
@@ -62,6 +62,7 @@ struct plplay {
pl_thread decoder_thread;
bool decoder_thread_created;
bool exit_thread;
bool error;
// settings / ui state
const struct pl_filter_preset *upscaler, *downscaler, *plane_scaler, *frame_mixer;
@@ -686,6 +687,13 @@ error:
return false;
}
static PL_THREAD_VOID render_thread(void *arg)
{
struct plplay *p = arg;
p->error = !render_loop(p);
PL_THREAD_RETURN();
}
static void info_callback(void *priv, const struct pl_render_info *info)
{
struct plplay *p = priv;
@@ -867,16 +875,23 @@ int main(int argc, char **argv)
goto error;
p->queue = pl_queue_create(p->win->gpu);
int ret = pl_thread_create(&p->decoder_thread, decode_loop, p);
int ret = pl_thread_create(&p->decoder_thread, PL_THREAD_NORMAL, decode_loop, p);
if (ret != 0) {
fprintf(stderr, "Failed creating decode thread: %s\n", strerror(errno));
goto error;
}
p->decoder_thread_created = true;
p->renderer = pl_renderer_create(p->log, p->win->gpu);
if (!render_loop(p))
pl_thread thread;
ret = pl_thread_create(&thread, PL_THREAD_REALTIME, render_thread, p);
if (ret != 0) {
fprintf(stderr, "Failed creating render thread: %s\n", strerror(errno));
goto error;
}
if (pl_thread_join(thread) != 0 || p->error)
goto error;
printf("Exiting...\n");
Loading