summaryrefslogtreecommitdiffhomepage
path: root/FoundationEx
diff options
context:
space:
mode:
Diffstat (limited to 'FoundationEx')
-rw-r--r--FoundationEx/Text.cpp6
-rw-r--r--FoundationEx/Text.h5
2 files changed, 2 insertions, 9 deletions
diff --git a/FoundationEx/Text.cpp b/FoundationEx/Text.cpp
index e73149a..972db7f 100644
--- a/FoundationEx/Text.cpp
+++ b/FoundationEx/Text.cpp
@@ -33,8 +33,6 @@ TextRep::TextRep()
// +-------------------------------------------------------------------+
-ThreadSync TextRep::sync;
-
TextRep::TextRep(const char* s)
: ref(1), length(0), sensitive(true)
@@ -101,17 +99,13 @@ TextRep::~TextRep()
void
TextRep::addref()
{
- sync.acquire();
ref++;
- sync.release();
}
long
TextRep::deref()
{
- sync.acquire();
long r = --ref;
- sync.release();
return r;
}
diff --git a/FoundationEx/Text.h b/FoundationEx/Text.h
index df5edae..0ade946 100644
--- a/FoundationEx/Text.h
+++ b/FoundationEx/Text.h
@@ -14,11 +14,11 @@
#ifndef Text_h
#define Text_h
+#include <atomic>
#include <ostream>
#include <string.h>
#include <windows.h>
-#include "ThreadSync.h"
// +-------------------------------------------------------------------+
@@ -42,12 +42,11 @@ private:
void dohash();
char* data;
- long ref;
+ std::atomic<long> ref;
int length;
unsigned hash;
bool sensitive;
- static ThreadSync sync;
static TextRep nullrep;
};