Regarding the creation of the extra threads: To be honest, I don't know how they are created and what with the main perl thread happens. This is managed by libmpv and I don't know and understand the code very well.. The error seems to occur in mpv_initialize from mpv-player/client.c, which calls mp_wakeup_core from mpv-player/playloop.c that triggers an event from the saved dispatch queue. mpv/misc/dispatch.c describes it as follows: "A dispatch queue lets other threads run callbacks in a target thread. The target thread is the thread which calls mp_dispatch_queue_process()." This is here mp_dispatch_interrupt which was called in mp_wakeup_core. So I think the target thread is created in mpv_create with the following lines:# perl thread (gdb) p my_perl $1 = (PerlInterpreter *) 0xb (...) dSP; (gdb) p my_perl $7 = (PerlInterpreter *) 0x555555953260 (...) # mpv thread: (gdb) p my_perl $2 = (PerlInterpreter *) 0x1 (...) dSP; (gdb) p my_perl $3 = (PerlInterpreter *) 0x0
core_thread() consists of the following lines:pthread_t thread; if (pthread_create(&thread, NULL, core_thread, mpctx) != 0) { ctx->clients->have_terminator = true; // avoid blocking mpv_terminate_destroy(ctx); mp_destroy(mpctx); return NULL; }
I don't know whether this is helpful. Perhaps the task is a number too big for me because I have no clue regarding threads? Nevertheless thank you very much for all your help and patience..static void *core_thread(void *p) { struct MPContext *mpctx = p; mpthread_set_name("mpv core"); while (!mpctx->initialized && mpctx->stop_play != PT_QUIT) mp_idle(mpctx); if (mpctx->initialized) mp_play_files(mpctx); // This actually waits until all clients are gone before actually // destroying mpctx. Actual destruction is done by whatever destro +ys // the last mpv_handle. mp_shutdown_clients(mpctx); return NULL; }
if (ctx->wakeup_cb) ctx->wakeup_cb(ctx->wakeup_cb_ctx);
In reply to Re^3: XS callback to mpv_set_wakeup_callback
by MaxPerl
in thread XS callback to mpv_set_wakeup_callback
by MaxPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |