qpulse: retry spawning mainloop thread
This commit is contained in:
parent
06c38bda9c
commit
b9a2e8cde3
15
qpulse.cpp
15
qpulse.cpp
@ -6,7 +6,20 @@ QPulse::QPulse(QObject *parent) :
|
|||||||
ml(pa_threaded_mainloop_new()),
|
ml(pa_threaded_mainloop_new()),
|
||||||
c(nullptr)
|
c(nullptr)
|
||||||
{
|
{
|
||||||
pa_threaded_mainloop_start(ml);
|
int start_retries = 5;
|
||||||
|
int err = -1;
|
||||||
|
for(; start_retries --> 0;) {
|
||||||
|
err = pa_threaded_mainloop_start(ml);
|
||||||
|
if (err == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fatal
|
||||||
|
if (err != 0) {
|
||||||
|
perror("pa_threaded_mainloop_start() failure\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
c = pa_context_new( pa_threaded_mainloop_get_api(ml), "pa-card-profile-tray");
|
c = pa_context_new( pa_threaded_mainloop_get_api(ml), "pa-card-profile-tray");
|
||||||
pa_context_set_state_callback(c, &QPulse::onConnectionStateChangedSt, this);
|
pa_context_set_state_callback(c, &QPulse::onConnectionStateChangedSt, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user