mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
Consolidate code using pthread_attr_setstacksize
This also adds some stack constraint to rt and fallback threads that didn't have those before (ALSA MIDI for example)
This commit is contained in:
parent
515ffbdfe2
commit
09aa0a3d1a
8 changed files with 28 additions and 61 deletions
|
|
@ -963,8 +963,7 @@ AlsaAudioBackend::_start (bool for_latency_measurement)
|
|||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
&_main_thread, pthread_process, this))
|
||||
{
|
||||
if (pthread_create (&_main_thread, NULL, pthread_process, this))
|
||||
{
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) {
|
||||
PBD::error << _("AlsaAudioBackend: failed to create process thread.") << endmsg;
|
||||
delete _pcmi; _pcmi = 0;
|
||||
_device_reservation.release_device();
|
||||
|
|
@ -1145,21 +1144,14 @@ AlsaAudioBackend::alsa_process_thread (void *arg)
|
|||
int
|
||||
AlsaAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
{
|
||||
pthread_t thread_id;
|
||||
pthread_attr_t attr;
|
||||
|
||||
pthread_t thread_id;
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC);
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
&thread_id, alsa_process_thread, td)) {
|
||||
pthread_attr_init (&attr);
|
||||
pthread_attr_setstacksize (&attr, PBD_RT_STACKSIZE_PROC);
|
||||
if (pthread_create (&thread_id, &attr, alsa_process_thread, td)) {
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) {
|
||||
PBD::error << _("AudioEngine: cannot create process thread.") << endmsg;
|
||||
pthread_attr_destroy (&attr);
|
||||
return -1;
|
||||
}
|
||||
pthread_attr_destroy (&attr);
|
||||
}
|
||||
|
||||
_threads.push_back (thread_id);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ AlsaMidiIO::start ()
|
|||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP,
|
||||
&_main_thread, pthread_process, this))
|
||||
{
|
||||
if (pthread_create (&_main_thread, NULL, pthread_process, this)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_HELP, &_main_thread, pthread_process, this)) {
|
||||
PBD::error << _("AlsaMidiIO: Failed to create process thread.") << endmsg;
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ AlsaAudioSlave::start ()
|
|||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_HELP,
|
||||
&_thread, _process_thread, this))
|
||||
{
|
||||
if (pthread_create (&_thread, NULL, _process_thread, this)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_HELP, &_thread, _process_thread, this)) {
|
||||
_run = false;
|
||||
PBD::error << _("AlsaAudioBackend: failed to create slave process thread.") << endmsg;
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue