Bug 40698 - cannot restart mainloop if this was stopped before
Summary: cannot restart mainloop if this was stopped before
Status: RESOLVED NOTABUG
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-07 14:28 UTC by Art Tevs
Modified: 2012-02-08 23:19 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Art Tevs 2011-09-07 14:28:59 UTC
Hi,

following appears to me as a bug and might be a subject for solving/discussing.

The internal state of the mainloop is wrong, after one do restarts it. Following example illustrates it:

// start and stop for the first time
pa_threaded_mainloop_start(m); 
pa_threaded_mainloop_stop(m);  // stop causes m->state = STATE_QUIT

// start and stop for the second time fails, because of an assertion
pa_threaded_mainloop_start(m);

this fails, since this assertion assert(m->state == STATE_PASSIVE) : mainloop.c:827 fires. 

The problem here is that the internal state hasn't been changed back to STATE_PASSIVE, as soon as it was restarted and remains STATE_QUIT, hence assertion fails. A solution might be to change the state accordingly in pa_mainloop_run, i.e.:

int pa_mainloop_run(pa_mainloop *m, int *retval) {
    int r;

    m->state = STATE_PASSIVE; // ADD THIS HERE
    while ((r = pa_mainloop_iterate(m, 1, retval)) >= 0);
...
Comment 1 Arun Raghavan 2012-02-08 23:19:10 UTC
The threaded mainloop is not intended to be started/stopped multiple times. Out of curiosity, though, why would you want to do this?


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.