summaryrefslogtreecommitdiff
path: root/server/src/templatelist.cc
diff options
context:
space:
mode:
authordeva <deva>2010-01-06 08:50:13 +0000
committerdeva <deva>2010-01-06 08:50:13 +0000
commit91988574b7b8d3ccdf186daee9a0f9c33b3803bb (patch)
tree77628545d616be4b4a7bf23ec8f175cfe483e5f2 /server/src/templatelist.cc
parent0e819eb42b4d680a99ae7b04702bfc9510495aee (diff)
Made MacroList and TemplateList threadsafe.
Diffstat (limited to 'server/src/templatelist.cc')
-rw-r--r--server/src/templatelist.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/src/templatelist.cc b/server/src/templatelist.cc
index cdf2b4b..bbaefc3 100644
--- a/server/src/templatelist.cc
+++ b/server/src/templatelist.cc
@@ -58,6 +58,8 @@ static std::vector<std::string> listdir(std::string path)
TemplateList::TemplateList(std::string templatepath)
{
+ MutexAutolock lock(mutex);
+
this->templatepath = templatepath;
std::vector<std::string> templates = listdir(templatepath);
std::vector<std::string>::iterator i = templates.begin();
@@ -93,6 +95,8 @@ TemplateList::TemplateList(std::string templatepath)
std::string TemplateList::getLatestVersion(std::string templ) throw(Exception)
{
+ MutexAutolock lock(mutex);
+
if(find(templ) == end()) throw Exception("Template ["+templ+"] does not exist");
TemplateListItem mli = (*this)[templ];
if(mli.size() == 0) return "";