summaryrefslogtreecommitdiff
path: root/cpp/test/uwp/controller
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2018-03-14 17:30:35 +0100
committerJose <jose@zeroc.com>2018-03-14 17:30:35 +0100
commit9f98e495d71e07bf4945b470f02612b8b4a02174 (patch)
tree9a099a5d51cba523b7e0e976e2677238cc783cbb /cpp/test/uwp/controller
parentMATLAB build failure with multiple MATLAB versions in PATH (diff)
downloadice-9f98e495d71e07bf4945b470f02612b8b4a02174.tar.bz2
ice-9f98e495d71e07bf4945b470f02612b8b4a02174.tar.xz
ice-9f98e495d71e07bf4945b470f02612b8b4a02174.zip
Serialize loading and unloading of UWP test DLLs
Diffstat (limited to 'cpp/test/uwp/controller')
-rw-r--r--cpp/test/uwp/controller/ViewController.xaml.cpp3
-rw-r--r--cpp/test/uwp/controller/ViewController.xaml.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/cpp/test/uwp/controller/ViewController.xaml.cpp b/cpp/test/uwp/controller/ViewController.xaml.cpp
index 281e973f519..62ae12cee92 100644
--- a/cpp/test/uwp/controller/ViewController.xaml.cpp
+++ b/cpp/test/uwp/controller/ViewController.xaml.cpp
@@ -17,7 +17,6 @@
#include <iostream>
#include <memory>
#include <condition_variable>
-#include <mutex>
using namespace std;
using namespace Controller;
@@ -487,6 +486,7 @@ ViewController::println(const string& s)
HINSTANCE
ViewController::loadDll(const string& name)
{
+ unique_lock<mutex> lock(_mutex);
map<string, pair<HINSTANCE, unsigned int>>::iterator p = _dlls.find(name);
if(p == _dlls.end())
{
@@ -500,6 +500,7 @@ ViewController::loadDll(const string& name)
void
ViewController::unloadDll(const string& name)
{
+ unique_lock<mutex> lock(_mutex);
map<string, pair<HINSTANCE, unsigned int>>::iterator p = _dlls.find(name);
assert(p != _dlls.end());
if(--p->second.second == 0)
diff --git a/cpp/test/uwp/controller/ViewController.xaml.h b/cpp/test/uwp/controller/ViewController.xaml.h
index a5d22575866..97fc0910e78 100644
--- a/cpp/test/uwp/controller/ViewController.xaml.h
+++ b/cpp/test/uwp/controller/ViewController.xaml.h
@@ -14,6 +14,7 @@
#include <map>
#include <string>
#include <memory>
+#include <mutex>
namespace
{
@@ -45,6 +46,7 @@ private:
void Hostname_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
std::map<std::string, std::pair<HINSTANCE, unsigned int>> _dlls;
+ std::mutex _mutex;
};
}