From 91988574b7b8d3ccdf186daee9a0f9c33b3803bb Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 6 Jan 2010 08:50:13 +0000 Subject: Made MacroList and TemplateList threadsafe. --- server/src/templatelist.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'server/src/templatelist.cc') 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 listdir(std::string path) TemplateList::TemplateList(std::string templatepath) { + MutexAutolock lock(mutex); + this->templatepath = templatepath; std::vector templates = listdir(templatepath); std::vector::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 ""; -- cgit v1.2.3