Allow to override default stack limit for background processes
This commit is contained in:
parent
2ae670055d
commit
4f3b8a9776
|
@ -58,7 +58,7 @@
|
|||
# define PBD_RT_PRI_MIDI pbd_pthread_priority (THREAD_MIDI)
|
||||
# define PBD_RT_PRI_PROC pbd_pthread_priority (THREAD_PROC)
|
||||
|
||||
LIBPBD_API int pthread_create_and_store (std::string name, pthread_t *thread, void * (*start_routine)(void *), void * arg);
|
||||
LIBPBD_API int pthread_create_and_store (std::string name, pthread_t *thread, void * (*start_routine)(void *), void * arg, uint32_t stacklimit = 0x80000 /*512kB*/);
|
||||
LIBPBD_API void pthread_cancel_one (pthread_t thread);
|
||||
LIBPBD_API void pthread_cancel_all ();
|
||||
LIBPBD_API void pthread_kill_all (int signum);
|
||||
|
|
|
@ -117,14 +117,16 @@ fake_thread_start (void* arg)
|
|||
}
|
||||
|
||||
int
|
||||
pthread_create_and_store (string name, pthread_t* thread, void* (*start_routine) (void*), void* arg)
|
||||
pthread_create_and_store (string name, pthread_t* thread, void* (*start_routine) (void*), void* arg, uint32_t stacklimit)
|
||||
{
|
||||
pthread_attr_t default_attr;
|
||||
int ret;
|
||||
|
||||
/* set default stack size to sensible default for memlocking */
|
||||
pthread_attr_init (&default_attr);
|
||||
pthread_attr_setstacksize (&default_attr, 0x80000); // 512kB
|
||||
if (stacklimit > 0) {
|
||||
pthread_attr_setstacksize (&default_attr, stacklimit);
|
||||
}
|
||||
|
||||
ThreadStartWithName* ts = new ThreadStartWithName (start_routine, arg, name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user