mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 14:56:58 +00:00
Make stack size be selectable
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
6
utils.c
6
utils.c
@@ -389,14 +389,16 @@ int ast_utils_init(void)
|
||||
}
|
||||
|
||||
|
||||
int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data)
|
||||
int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data, size_t stacksize)
|
||||
{
|
||||
pthread_attr_t lattr;
|
||||
if (!attr) {
|
||||
pthread_attr_init(&lattr);
|
||||
attr = &lattr;
|
||||
}
|
||||
errno = pthread_attr_setstacksize(attr, AST_STACKSIZE);
|
||||
if (!stacksize)
|
||||
stacksize = AST_STACKSIZE;
|
||||
errno = pthread_attr_setstacksize(attr, stacksize);
|
||||
if (errno)
|
||||
ast_log(LOG_WARNING, "pthread_attr_setstacksize returned non-zero: %s\n", strerror(errno));
|
||||
return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */
|
||||
|
Reference in New Issue
Block a user