mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 23:05:29 +00:00
os: fix crash when creating non high priority thread fails
This commit is contained in:
parent
dbed33abd2
commit
71e31b88fe
|
@ -359,7 +359,8 @@ struct SoundIo {
|
||||||
/// This callback is fired when making thread real-time priority failed. By
|
/// This callback is fired when making thread real-time priority failed. By
|
||||||
/// default, it will print to stderr only the first time it is called
|
/// default, it will print to stderr only the first time it is called
|
||||||
/// a message instructing the user how to configure their system to allow
|
/// a message instructing the user how to configure their system to allow
|
||||||
/// real-time priority threads.
|
/// real-time priority threads. This must be set to a function not NULL.
|
||||||
|
/// To silence the warning, assign this to a function that does nothing.
|
||||||
void (*emit_rtprio_warning)(void);
|
void (*emit_rtprio_warning)(void);
|
||||||
|
|
||||||
/// Optional: JACK info callback.
|
/// Optional: JACK info callback.
|
||||||
|
|
|
@ -234,7 +234,7 @@ int soundio_os_thread_create(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = pthread_create(&thread->id, &thread->attr, run_pthread, thread))) {
|
if ((err = pthread_create(&thread->id, &thread->attr, run_pthread, thread))) {
|
||||||
if (err == EPERM) {
|
if (err == EPERM && emit_rtprio_warning) {
|
||||||
emit_rtprio_warning();
|
emit_rtprio_warning();
|
||||||
err = pthread_create(&thread->id, NULL, run_pthread, thread);
|
err = pthread_create(&thread->id, NULL, run_pthread, thread);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue