diff options
author | David Robillard <d@drobilla.net> | 2007-01-11 19:50:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-11 19:50:49 +0000 |
commit | f7563c2b158252339f98e38719cfc3e092ef7ac7 (patch) | |
tree | b90084b8cc82e613a9dfc73202fdffcf0a05481d /libs/pbd | |
parent | 532f6aad4ac79ca15d69deccd18fca90e444c437 (diff) |
Merged with trunk R1304
git-svn-id: svn://localhost/ardour2/branches/midi@1311 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/pbd/xml++.h | 3 | ||||
-rw-r--r-- | libs/pbd/pthread_utils.cc | 14 | ||||
-rw-r--r-- | libs/pbd/xml++.cc | 20 |
3 files changed, 34 insertions, 3 deletions
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h index 70e231e717..bf26a6f685 100644 --- a/libs/pbd/pbd/xml++.h +++ b/libs/pbd/pbd/xml++.h @@ -95,8 +95,11 @@ public: const XMLPropertyList & properties() const { return _proplist; }; XMLProperty *property(const char * ); + XMLProperty *property(const std::string&); const XMLProperty *property(const char * n) const { return ((XMLNode *) this)->property(n); }; + const XMLProperty *property(const std::string& ns) const + { return ((XMLNode *) this)->property(ns); }; XMLProperty *add_property(const char *, const string &); XMLProperty *add_property(const char *, const char * = ""); 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; } diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 8d783d59f2..5507f658e9 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -289,11 +289,25 @@ XMLProperty * XMLNode::property(const char * n) { string ns(n); - if (_propmap.find(ns) == _propmap.end()) { - return 0; + map<string,XMLProperty*>::iterator iter; + + if ((iter = _propmap.find(ns)) != _propmap.end()) { + return iter->second; + } + + return 0; +} + +XMLProperty * +XMLNode::property(const string & ns) +{ + map<string,XMLProperty*>::iterator iter; + + if ((iter = _propmap.find(ns)) != _propmap.end()) { + return iter->second; } - return _propmap[ns]; + return 0; } XMLProperty * |