summaryrefslogtreecommitdiff
path: root/modules/mono/utils/thread_local.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/utils/thread_local.h')
-rw-r--r--modules/mono/utils/thread_local.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/modules/mono/utils/thread_local.h b/modules/mono/utils/thread_local.h
index 84dae1d86b..d7d98c47e2 100644
--- a/modules/mono/utils/thread_local.h
+++ b/modules/mono/utils/thread_local.h
@@ -108,17 +108,23 @@ class ThreadLocal {
return data;
}
+ void _initialize(const T &p_init_val) {
+ init_val = p_init_val;
+ storage.alloc(&destr_callback);
+ }
+
public:
- ThreadLocal() :
- ThreadLocal(T()) {}
+ ThreadLocal() {
+ _initialize(T());
+ }
- ThreadLocal(const T &p_init_val) :
- init_val(p_init_val) {
- storage.alloc(&destr_callback);
+ ThreadLocal(const T &p_init_val) {
+ _initialize(p_init_val);
}
- ThreadLocal(const ThreadLocal &other) :
- ThreadLocal(*other._tls_get_value()) {}
+ ThreadLocal(const ThreadLocal &other) {
+ _initialize(*other._tls_get_value());
+ }
~ThreadLocal() {
storage.free();