summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-27 19:30:30 +0200
committerAki <please@ignore.pl>2022-03-27 19:30:30 +0200
commit2ba515370864b85bd29b0d23083248c74a868691 (patch)
treeed2252bb9ea2343f3b9932f5906e59ca828d24b7
parenta12e588079700d55a0b788fea2df7727c2e41f52 (diff)
downloadstarshatter-2ba515370864b85bd29b0d23083248c74a868691.zip
starshatter-2ba515370864b85bd29b0d23083248c74a868691.tar.gz
starshatter-2ba515370864b85bd29b0d23083248c74a868691.tar.bz2
Replaced own ThreadSync with atomic variable in Text
-rw-r--r--FoundationEx/Text.cpp6
-rw-r--r--FoundationEx/Text.h5
-rw-r--r--NetEx/NetMsg.h1
-rw-r--r--NetEx/NetServer.h1
-rw-r--r--Stars45/CmpSelectDlg.cpp1
-rw-r--r--Stars45/CmpSelectDlg.h1
-rw-r--r--Stars45/MusicDirector.cpp1
-rw-r--r--Stars45/MusicDirector.h1
-rw-r--r--Stars45/RadioView.cpp1
-rw-r--r--Stars45/RadioView.h1
10 files changed, 10 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;
};
diff --git a/NetEx/NetMsg.h b/NetEx/NetMsg.h
index 1a8585f..4918c36 100644
--- a/NetEx/NetMsg.h
+++ b/NetEx/NetMsg.h
@@ -20,6 +20,7 @@
#include "NetGram.h"
#include "NetSock.h"
#include "List.h"
+#include "ThreadSync.h"
// +-------------------------------------------------------------------+
diff --git a/NetEx/NetServer.h b/NetEx/NetServer.h
index 29dffde..94bff95 100644
--- a/NetEx/NetServer.h
+++ b/NetEx/NetServer.h
@@ -20,6 +20,7 @@
#include "NetGram.h"
#include "NetSock.h"
#include "List.h"
+#include "ThreadSync.h"
// +-------------------------------------------------------------------+
diff --git a/Stars45/CmpSelectDlg.cpp b/Stars45/CmpSelectDlg.cpp
index afcf6d2..18ba3d0 100644
--- a/Stars45/CmpSelectDlg.cpp
+++ b/Stars45/CmpSelectDlg.cpp
@@ -32,6 +32,7 @@
#include "Mouse.h"
#include "ParseUtil.h"
#include "FormatUtil.h"
+#include "ThreadSync.h"
// +--------------------------------------------------------------------+
// DECLARE MAPPING FUNCTIONS:
diff --git a/Stars45/CmpSelectDlg.h b/Stars45/CmpSelectDlg.h
index 99ed29b..7463aec 100644
--- a/Stars45/CmpSelectDlg.h
+++ b/Stars45/CmpSelectDlg.h
@@ -22,6 +22,7 @@
#include "ListBox.h"
#include "Font.h"
#include "Text.h"
+#include "ThreadSync.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/MusicDirector.cpp b/Stars45/MusicDirector.cpp
index fdcfafc..34e48a6 100644
--- a/Stars45/MusicDirector.cpp
+++ b/Stars45/MusicDirector.cpp
@@ -20,6 +20,7 @@
#include "DataLoader.h"
#include "FormatUtil.h"
#include "Sound.h"
+#include "ThreadSync.h"
static MusicDirector* music_director = 0;
diff --git a/Stars45/MusicDirector.h b/Stars45/MusicDirector.h
index 9984cf9..293b6d7 100644
--- a/Stars45/MusicDirector.h
+++ b/Stars45/MusicDirector.h
@@ -19,6 +19,7 @@
#include "Types.h"
#include "List.h"
#include "Text.h"
+#include "ThreadSync.h"
// +-------------------------------------------------------------------+
diff --git a/Stars45/RadioView.cpp b/Stars45/RadioView.cpp
index ca30092..fe29a5d 100644
--- a/Stars45/RadioView.cpp
+++ b/Stars45/RadioView.cpp
@@ -35,6 +35,7 @@
#include "Clock.h"
#include "ContentBundle.h"
#include "Menu.h"
+#include "ThreadSync.h"
static Color hud_color = Color::Black;
static Color txt_color = Color::White;
diff --git a/Stars45/RadioView.h b/Stars45/RadioView.h
index ef53c0a..31b0887 100644
--- a/Stars45/RadioView.h
+++ b/Stars45/RadioView.h
@@ -19,6 +19,7 @@
#include "Color.h"
#include "SimObject.h"
#include "Text.h"
+#include "ThreadSync.h"
// +--------------------------------------------------------------------+