mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
unfortunately we cannot detect if a foreign thread is still running. Thus sucks. But what can we do? U. Drepper thinks our use case is invalid.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1458 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
872018efc8
commit
6a2dffd78a
1 changed files with 6 additions and 11 deletions
|
|
@ -112,16 +112,11 @@ pa_thread* pa_thread_new(pa_thread_func_t thread_func, void *userdata) {
|
||||||
int pa_thread_is_running(pa_thread *t) {
|
int pa_thread_is_running(pa_thread *t) {
|
||||||
assert(t);
|
assert(t);
|
||||||
|
|
||||||
if (!t->thread_func) {
|
/* Unfortunately there is no way to tell whether a "foreign"
|
||||||
/* Mhmm, this is a foreign thread, t->running is not
|
* thread is still running. See
|
||||||
* necessarily valid. We misuse pthread_getschedparam() to
|
* http://udrepper.livejournal.com/16844.html for more
|
||||||
* check if the thread is valid. This might not be portable. */
|
* information */
|
||||||
|
assert(t->thread_func);
|
||||||
int policy;
|
|
||||||
struct sched_param param;
|
|
||||||
|
|
||||||
return pthread_getschedparam(t->id, &policy, ¶m) >= 0 || errno != ESRCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pa_atomic_load(&t->running) > 0;
|
return pa_atomic_load(&t->running) > 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue