summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-03-14 22:55:22 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2016-03-14 22:55:22 +0100
commit918797735da29f102f027b9dc19dccc751950c76 (patch)
treeb200521d974d80a718841266be056aa6c9fed057 /include
parentfda335ddf21d174101e3d72a10f2eba8b4faefcf (diff)
Made the library thread-safe by guarding the kernel cache with a mutex
Diffstat (limited to 'include')
-rw-r--r--include/internal/routine.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/internal/routine.h b/include/internal/routine.h
index b7c06a97..5f5b8211 100644
--- a/include/internal/routine.h
+++ b/include/internal/routine.h
@@ -18,6 +18,7 @@
#include <string>
#include <vector>
+#include <mutex>
#include "internal/utilities.h"
#include "internal/database.h"
@@ -46,8 +47,9 @@ class Routine {
}
};
- // The actual cache, implemented as a vector of the above data-type
+ // The actual cache, implemented as a vector of the above data-type, and its mutex
static std::vector<ProgramCache> program_cache_;
+ static std::mutex program_cache_mutex_;
// Helper functions which check for errors in the status code
static constexpr bool ErrorIn(const StatusCode s) { return (s != StatusCode::kSuccess); }