diff options
author | David Robillard <d@drobilla.net> | 2007-01-10 03:26:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-10 03:26:22 +0000 |
commit | 2d62ded1aa92b82d696fb37c952732ae1a309011 (patch) | |
tree | 656623bf94a288679250e1448e5aeb0c0050f19a /libs/pbd/pthread_utils.cc | |
parent | 5c7a3c680b1dc09bda55401b18d27b98f3b312cb (diff) |
Reduced allocated stack sizes. Trims about 13MB of memory consumption.
git-svn-id: svn://localhost/ardour2/trunk@1293 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pthread_utils.cc')
-rw-r--r-- | libs/pbd/pthread_utils.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc index db242cea7b..3408f2c0b7 100644 --- a/libs/pbd/pthread_utils.cc +++ b/libs/pbd/pthread_utils.cc @@ -43,6 +43,16 @@ pthread_create_and_store (string name, pthread_t *thread, pthread_attr_t *attr, { int ret; + pthread_attr_t default_attr; + bool use_default_attr = (attr == NULL); + + if (use_default_attr) { + // set default stack size to sensible default for memlocking + pthread_attr_init(&default_attr); + pthread_attr_setstacksize(&default_attr, 500000); + attr = &default_attr; + } + if ((ret = pthread_create (thread, attr, start_routine, arg)) == 0) { std::pair<string,pthread_t> newpair; newpair.first = name; @@ -53,6 +63,10 @@ pthread_create_and_store (string name, pthread_t *thread, pthread_attr_t *attr, pthread_mutex_unlock (&thread_map_lock); } + + if (use_default_attr) { + pthread_attr_destroy(&default_attr); + } return ret; } |