<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED NOTOURBUG - PulseAudio Python Binding PyEval_CallFunction segfault in pa_mainloop_dispatch based on pa_threaded_mainloop"
href="https://bugs.freedesktop.org/show_bug.cgi?id=61328#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED NOTOURBUG - PulseAudio Python Binding PyEval_CallFunction segfault in pa_mainloop_dispatch based on pa_threaded_mainloop"
href="https://bugs.freedesktop.org/show_bug.cgi?id=61328">bug 61328</a>
from <span class="vcard"><a class="email" href="mailto:tanuk@iki.fi" title="Tanu Kaskinen <tanuk@iki.fi>"> <span class="fn">Tanu Kaskinen</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=61328#c3">comment #3</a>)
<span class="quote">> Thank Tanu`s reply :)
>
> Yes pa_threaded_mainloop is working correctly in my cgtk.c and console.py
> testcases
> <a href="https://github.com/xiangzhai/pypulseaudio/blob/master/examples/cgtk.c">https://github.com/xiangzhai/pypulseaudio/blob/master/examples/cgtk.c</a>
>
> But the pygtk.py testcase is different from console.py, because there is
> already a GMainLoop in PyGtk (Gtk+-2.0 Python Binding), so is it possible
> that shared data from concurrent modifications by pa_threaded_mainloop &&
> GMainLoop?</span >
No, I'm pretty sure pa_threaded_mainloop and GMainloop do not access or modify
any shared data.
The problem might be that PyEval_CallFunction() is called from the thread
created by pa_threaded_mainloop. The GMainLoop runs in a different thread, so
if PyEval_CallFunction() expects to be run in the GMainLoop thread, things will
explode.
Are you sure pa_threaded_mainloop is the right choice? If you're using
GMainLoop, you can use pa_glib_mainloop to integrate libpulse with the same
GMainLoop that you're already using. If you specifically want to run the
pulseaudio stuff in a separate thread, pa_threaded_mainloop can be used, but
then you must not call PyEval_CallFunction() directly from the libpulse
callbacks, but instead notify the GMainLoop thread about the events and call
PyEval_CallFunction() from the GMainLoop thread.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>