<div dir="ltr">Just for info for people who don't know JNI.<br><br>When calling java code from c, it is mandatory to attach a java thread to the c thread. When we attach a java thread from the c thread, it creates a java thread and we specify a name for it.<br><br>So your first solution which consists in attaching the thread at the beginning of the "wrapper_logger" method and detaching at the end of this method works but I have to monitor if it is not too expensive for the JVM.<br>I've never been in this case, in general we attach to the creation of the thread and we detach at the end<br><br>Otherwise your second solution is the most interesting if it is not possible to execute code at the end.<br>the main thread is already attached because the caller is Java, then as you say, you have to put the messages of the ffmpeg worker threads in a global variable<br><br>Any idea is good to take, a community is made to share ideas, a bad idea can lead to other good idea<br><br>Thanks very much<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 24 mars 2022 à 20:32, Simon <<a href="mailto:staircase@sector-alpha.net">staircase@sector-alpha.net</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, <br><br>Even if you aren't creating per-thread objects, java is when you register the thread. Two options I can see are:<br>1) tidy up before you return control - this would mean register the thread with java only while in your logging callback and unregister before returning. <br>2) Only log to java from a single thread and get the other threads to queue the log messages up in some global object. <br><br>I expect my second option is actually the most practical. You can have a thread then runs as long as any task is running and just pulls log messages out of the queue and posts them to java. <br><br>Hope that's helpful. <br><br>Simon <br><br>Sent from my Huawei Mobile_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div>