summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--FoundationEx/ThreadSync.h56
-rw-r--r--NetEx/HttpServletExec.cpp4
-rw-r--r--NetEx/NetLink.cpp31
-rw-r--r--NetEx/NetLink.h5
-rw-r--r--NetEx/NetMsg.h1
-rw-r--r--NetEx/NetPeer.cpp2
-rw-r--r--NetEx/NetPeer.h5
-rw-r--r--NetEx/NetServer.cpp12
-rw-r--r--NetEx/NetServer.h5
-rw-r--r--Stars45/CmpSelectDlg.cpp21
-rw-r--r--Stars45/CmpSelectDlg.h5
-rw-r--r--Stars45/MusicDirector.cpp6
-rw-r--r--Stars45/MusicDirector.h5
-rw-r--r--Stars45/RadioView.cpp7
-rw-r--r--Stars45/RadioView.h5
-rw-r--r--Stars45/RadioVox.cpp9
-rw-r--r--Stars45/SoundCard.cpp6
-rw-r--r--Stars45/SoundCard.h5
-rw-r--r--Stars45/SoundD3D.cpp9
-rw-r--r--Stars45/SoundD3D.h5
20 files changed, 81 insertions, 123 deletions
diff --git a/FoundationEx/ThreadSync.h b/FoundationEx/ThreadSync.h
deleted file mode 100644
index ccf79f4..0000000
--- a/FoundationEx/ThreadSync.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Starshatter: The Open Source Project
- Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
- Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
- Copyright (c) 1997-2006, Destroyer Studios LLC.
-
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
- Declaration of the ThreadSync class
-*/
-
-#ifndef ThreadSync_h
-#define ThreadSync_h
-
-#include <windows.h>
-
-// +-------------------------------------------------------------------+
-
-class ThreadSync
-{
-#if defined(_MT) // MULTITHREADED: WITH SYNC ------------
- CRITICAL_SECTION sync;
-
-public:
- ThreadSync() { ::InitializeCriticalSection(&sync); }
- ~ThreadSync() { ::DeleteCriticalSection(&sync); }
-
- void acquire() { ::EnterCriticalSection(&sync); }
- void release() { ::LeaveCriticalSection(&sync); }
-
-#else // SINGLE THREADED: NO SYNC ------------
-
-public:
- ThreadSync() { }
- ~ThreadSync() { }
-
- void acquire() { }
- void release() { }
-
-#endif
-};
-
-// +-------------------------------------------------------------------+
-
-class AutoThreadSync
-{
-public:
- AutoThreadSync(ThreadSync& s) : sync(s) { sync.acquire(); }
- ~AutoThreadSync() { sync.release(); }
-private:
- ThreadSync& sync;
-};
-
-#endif // ThreadSync_h
diff --git a/NetEx/HttpServletExec.cpp b/NetEx/HttpServletExec.cpp
index 357a5f8..b8d92f7 100644
--- a/NetEx/HttpServletExec.cpp
+++ b/NetEx/HttpServletExec.cpp
@@ -200,7 +200,7 @@ DWORD
HttpServletExec::CheckSessions()
{
while (!exec_shutdown) {
- sync.acquire();
+ sync.lock();
if (sessions.size()) {
ListIter<HttpSession> iter = sessions;
@@ -216,7 +216,7 @@ HttpServletExec::CheckSessions()
DoSyncedCheck();
- sync.release();
+ sync.unlock();
Sleep(100);
}
diff --git a/NetEx/NetLink.cpp b/NetEx/NetLink.cpp
index bbba59b..10e817a 100644
--- a/NetEx/NetLink.cpp
+++ b/NetEx/NetLink.cpp
@@ -87,9 +87,8 @@ NetLink::AddPeer(const NetAddr& a)
if (!a.IPAddr())
return 0;
- AutoThreadSync auto_sync(sync);
-
NetPeer* peer = FindPeer(a);
+ const std::lock_guard<std::mutex> lock(sync);
if (!peer) {
peer = new NetPeer(a, base_netid++);
@@ -149,9 +148,9 @@ NetLink::GetMessage(DWORD netid)
if (p) {
msg = p->GetMessage();
- sync.acquire();
+ sync.lock();
recv_list.remove(msg);
- sync.release();
+ sync.unlock();
}
}
@@ -169,11 +168,11 @@ NetLink::GetMessage()
// Double-checked locking:
if (recv_list.size()) {
- sync.acquire();
+ sync.lock();
if (recv_list.size()) {
msg = recv_list.removeIndex(0);
}
- sync.release();
+ sync.unlock();
if (msg && msg->NetID()) {
NetPeer* p = FindPeer(msg->NetID());
@@ -216,7 +215,7 @@ NetLink::DoSendRecv()
SendPackets();
// discard reeeeally old peers:
- sync.acquire();
+ sync.lock();
ListIter<NetPeer> iter = peer_list;
while (!shutdown && ++iter) {
@@ -226,7 +225,7 @@ NetLink::DoSendRecv()
delete iter.removeItem();
}
- sync.release();
+ sync.unlock();
Sleep(traffic_time);
}
@@ -265,7 +264,7 @@ NetLink::SendPackets()
DoRetries();
}
- AutoThreadSync auto_sync(sync);
+ const std::lock_guard<std::mutex> lock(sync);
ListIter<NetPeer> iter = peer_list;
while (!shutdown && ++iter) {
@@ -345,7 +344,7 @@ void
NetLink::ProcessAck(NetGram* gram)
{
if (!shutdown && send_list.size()) {
- AutoThreadSync auto_sync(sync);
+ sync.lock();
// remove the ack flag:
gram->ClearAck();
@@ -361,7 +360,9 @@ NetLink::ProcessAck(NetGram* gram)
if (lag_index >= 10) lag_index = 0;
lag_samples[lag_index++] = msec;
+ sync.unlock();
NetPeer* peer = FindPeer(orig->Address());
+ sync.lock();
if (peer)
peer->SetLastReceiveTime(NetLayer::GetUTC());
@@ -374,6 +375,7 @@ NetLink::ProcessAck(NetGram* gram)
else
resend_time = 300;
}
+ sync.unlock();
}
}
@@ -381,10 +383,9 @@ void
NetLink::QueueNetGram(NetGram* gram)
{
if (!shutdown) {
- AutoThreadSync auto_sync(sync);
-
DWORD sequence = 0;
NetPeer* peer = FindPeer(gram->Address());
+ const std::lock_guard<std::mutex> lock(sync);
if (peer) {
sequence = peer->Sequence();
@@ -415,7 +416,7 @@ void
NetLink::DoRetries()
{
if (!shutdown) {
- AutoThreadSync auto_sync(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (send_list.size()) {
int time = (int) NetLayer::GetTime();
@@ -452,7 +453,7 @@ NetLink::DoRetries()
NetPeer*
NetLink::FindPeer(DWORD netid)
{
- AutoThreadSync auto_sync(sync);
+ const std::lock_guard<std::mutex> lock(sync);
NetPeer* peer = 0;
ListIter<NetPeer> iter = peer_list;
@@ -469,7 +470,7 @@ NetLink::FindPeer(DWORD netid)
NetPeer*
NetLink::FindPeer(const NetAddr& a)
{
- AutoThreadSync auto_sync(sync);
+ const std::lock_guard<std::mutex> lock(sync);
NetPeer* peer = 0;
ListIter<NetPeer> iter = peer_list;
diff --git a/NetEx/NetLink.h b/NetEx/NetLink.h
index c039fe7..33024f3 100644
--- a/NetEx/NetLink.h
+++ b/NetEx/NetLink.h
@@ -15,11 +15,12 @@
#ifndef NetLink_h
#define NetLink_h
+#include <mutex>
+
#include <windows.h>
#include "NetAddr.h"
#include "NetSock.h"
#include "List.h"
-#include "ThreadSync.h"
// +-------------------------------------------------------------------+
@@ -91,7 +92,7 @@ protected:
HANDLE hnet;
bool shutdown;
- ThreadSync sync;
+ std::mutex sync;
DWORD resend_time;
DWORD traffic_time;
diff --git a/NetEx/NetMsg.h b/NetEx/NetMsg.h
index 4918c36..1a8585f 100644
--- a/NetEx/NetMsg.h
+++ b/NetEx/NetMsg.h
@@ -20,7 +20,6 @@
#include "NetGram.h"
#include "NetSock.h"
#include "List.h"
-#include "ThreadSync.h"
// +-------------------------------------------------------------------+
diff --git a/NetEx/NetPeer.cpp b/NetEx/NetPeer.cpp
index a324f94..6adbe71 100644
--- a/NetEx/NetPeer.cpp
+++ b/NetEx/NetPeer.cpp
@@ -143,7 +143,7 @@ NetPeer::ComposeGram()
NetGram* g = 0;
if ((send_list.size() || multi_send_list.size()) && OKtoSend()) {
- AutoThreadSync auto_sync(sync);
+ const std::lock_guard<std::mutex> lock(sync);
int xmit_size = send_size;
int nmsg = send_list.size();
diff --git a/NetEx/NetPeer.h b/NetEx/NetPeer.h
index 95bfb5c..3610f1b 100644
--- a/NetEx/NetPeer.h
+++ b/NetEx/NetPeer.h
@@ -15,10 +15,11 @@
#ifndef NetPeer_h
#define NetPeer_h
+#include <mutex>
+
#include <windows.h>
#include "NetAddr.h"
#include "List.h"
-#include "ThreadSync.h"
// +-------------------------------------------------------------------+
@@ -90,7 +91,7 @@ private:
List<NetMsg> multi_send_list;
List<NetMsg> multi_recv_list;
- ThreadSync sync;
+ std::mutex sync;
};
diff --git a/NetEx/NetServer.cpp b/NetEx/NetServer.cpp
index 7681aa1..665b69b 100644
--- a/NetEx/NetServer.cpp
+++ b/NetEx/NetServer.cpp
@@ -117,7 +117,7 @@ NetServer::Listener()
NetSock* s = sock.accept(&client_addr);
while (s) {
- sync.acquire();
+ sync.lock();
for (int i = 0; i < poolsize; i++) {
if (conn[i] == 0) {
@@ -128,7 +128,7 @@ NetServer::Listener()
}
}
- sync.release();
+ sync.unlock();
// wait for a thread to become not busy
if (s)
@@ -164,9 +164,9 @@ NetServer::Reader(int index)
srand(timeGetTime());
while (!server_shutdown) {
- sync.acquire();
+ sync.lock();
NetSock* s = conn[index];
- sync.release();
+ sync.unlock();
if (s) {
const int MAX_REQUEST = 4096;
@@ -202,10 +202,10 @@ NetServer::Reader(int index)
}
}
- sync.acquire();
+ sync.lock();
delete conn[index];
conn[index] = 0;
- sync.release();
+ sync.unlock();
}
else {
Sleep(5);
diff --git a/NetEx/NetServer.h b/NetEx/NetServer.h
index 94bff95..0869f2a 100644
--- a/NetEx/NetServer.h
+++ b/NetEx/NetServer.h
@@ -15,12 +15,13 @@
#ifndef NetServer_h
#define NetServer_h
+#include <mutex>
+
#include <windows.h>
#include "NetAddr.h"
#include "NetGram.h"
#include "NetSock.h"
#include "List.h"
-#include "ThreadSync.h"
// +-------------------------------------------------------------------+
@@ -58,7 +59,7 @@ protected:
int err;
bool server_shutdown;
- ThreadSync sync;
+ std::mutex sync;
};
diff --git a/Stars45/CmpSelectDlg.cpp b/Stars45/CmpSelectDlg.cpp
index 18ba3d0..95f9efa 100644
--- a/Stars45/CmpSelectDlg.cpp
+++ b/Stars45/CmpSelectDlg.cpp
@@ -11,6 +11,8 @@
Mission Select Dialog Active Window class
*/
+#include <mutex>
+
#include "CmpSelectDlg.h"
#include "ConfirmDlg.h"
#include "MenuScreen.h"
@@ -32,7 +34,6 @@
#include "Mouse.h"
#include "ParseUtil.h"
#include "FormatUtil.h"
-#include "ThreadSync.h"
// +--------------------------------------------------------------------+
// DECLARE MAPPING FUNCTIONS:
@@ -118,7 +119,7 @@ CmpSelectDlg::ExecFrame()
OnAccept(0);
}
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (loaded) {
loaded = false;
@@ -197,7 +198,7 @@ CmpSelectDlg::ExecFrame()
bool
CmpSelectDlg::CanClose()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
return !loading;
}
@@ -206,7 +207,7 @@ CmpSelectDlg::CanClose()
void
CmpSelectDlg::ShowNewCampaigns()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (loading && description) {
description->SetText(ContentBundle::GetInstance()->GetText("CmpSelectDlg.already-loading"));
@@ -283,7 +284,7 @@ CmpSelectDlg::ShowNewCampaigns()
void
CmpSelectDlg::ShowSavedCampaigns()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (loading && description) {
description->SetText(ContentBundle::GetInstance()->GetText("CmpSelectDlg.already-loading"));
@@ -332,7 +333,7 @@ void
CmpSelectDlg::OnCampaignSelect(AWEvent* event)
{
if (description && lst_campaigns) {
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (loading) {
description->SetText(ContentBundle::GetInstance()->GetText("CmpSelectDlg.already-loading"));
@@ -363,7 +364,7 @@ CmpSelectDlg::OnCampaignSelect(AWEvent* event)
images[i]->CopyBitmap(*c->GetImage(1));
lst_campaigns->SetItemImage(i, images[i]);
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
load_index = i;
}
else {
@@ -486,7 +487,7 @@ CmpSelectDlg::OnConfirmDelete(AWEvent* event)
void
CmpSelectDlg::OnAccept(AWEvent* event)
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (loading)
return;
@@ -594,13 +595,13 @@ CmpSelectDlg::LoadProc()
c = savegame.GetCampaign();
}
- sync.acquire();
+ sync.lock();
loading = false;
loaded = true;
campaign = c;
- sync.release();
+ sync.unlock();
return 0;
}
diff --git a/Stars45/CmpSelectDlg.h b/Stars45/CmpSelectDlg.h
index 7463aec..093e21d 100644
--- a/Stars45/CmpSelectDlg.h
+++ b/Stars45/CmpSelectDlg.h
@@ -14,6 +14,8 @@
#ifndef CmpSelectDlg_h
#define CmpSelectDlg_h
+#include <mutex>
+
#include "Types.h"
#include "FormWindow.h"
#include "Bitmap.h"
@@ -22,7 +24,6 @@
#include "ListBox.h"
#include "Font.h"
#include "Text.h"
-#include "ThreadSync.h"
// +--------------------------------------------------------------------+
@@ -76,7 +77,7 @@ protected:
Campaign* campaign;
int selected_mission;
HANDLE hproc;
- ThreadSync sync;
+ std::mutex sync;
bool loading;
bool loaded;
Text load_file;
diff --git a/Stars45/MusicDirector.cpp b/Stars45/MusicDirector.cpp
index 34e48a6..b2ff7ef 100644
--- a/Stars45/MusicDirector.cpp
+++ b/Stars45/MusicDirector.cpp
@@ -12,6 +12,7 @@
of background music tracks for both menu and game modes
*/
+#include <mutex>
#include "MusicDirector.h"
#include "MusicTrack.h"
@@ -20,7 +21,6 @@
#include "DataLoader.h"
#include "FormatUtil.h"
#include "Sound.h"
-#include "ThreadSync.h"
static MusicDirector* music_director = 0;
@@ -91,7 +91,7 @@ MusicDirector::ExecFrame()
{
if (no_music) return;
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (next_track && !track) {
track = next_track;
@@ -273,7 +273,7 @@ MusicDirector::SetMode(int mode)
{
if (!music_director || music_director->no_music) return;
- AutoThreadSync a(music_director->sync);
+ const std::lock_guard<std::mutex> lock(music_director->sync);
// stay in intro mode until it is complete:
if (mode == MENU && (music_director->GetMode() == NONE ||
diff --git a/Stars45/MusicDirector.h b/Stars45/MusicDirector.h
index 293b6d7..8fc6812 100644
--- a/Stars45/MusicDirector.h
+++ b/Stars45/MusicDirector.h
@@ -16,10 +16,11 @@
#ifndef MusicDirector_h
#define MusicDirector_h
+#include <mutex>
+
#include "Types.h"
#include "List.h"
#include "Text.h"
-#include "ThreadSync.h"
// +-------------------------------------------------------------------+
@@ -108,7 +109,7 @@ protected:
bool no_music;
HANDLE hproc;
- ThreadSync sync;
+ std::mutex sync;
};
#endif // MusicDirector_h \ No newline at end of file
diff --git a/Stars45/RadioView.cpp b/Stars45/RadioView.cpp
index fe29a5d..8a63091 100644
--- a/Stars45/RadioView.cpp
+++ b/Stars45/RadioView.cpp
@@ -11,6 +11,8 @@
View class for Radio Communications HUD Overlay
*/
+#include <mutex>
+
#include "RadioView.h"
#include "RadioMessage.h"
#include "RadioTraffic.h"
@@ -35,7 +37,6 @@
#include "Clock.h"
#include "ContentBundle.h"
#include "Menu.h"
-#include "ThreadSync.h"
static Color hud_color = Color::Black;
static Color txt_color = Color::White;
@@ -163,7 +164,7 @@ static bool TargetRequired(const MenuItem* item)
// +====================================================================+
RadioView* RadioView::radio_view = 0;
-ThreadSync RadioView::sync;
+std::mutex RadioView::sync;
RadioView::RadioView(Window* c)
: View(c), sim(0), ship(0), font(0), dst_elem(0)
@@ -601,7 +602,7 @@ RadioView::GetRadioMenu(Ship* s)
void
RadioView::Message(const char* msg)
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (radio_view) {
int index = -1;
diff --git a/Stars45/RadioView.h b/Stars45/RadioView.h
index 31b0887..1d25459 100644
--- a/Stars45/RadioView.h
+++ b/Stars45/RadioView.h
@@ -14,12 +14,13 @@
#ifndef RadioView_h
#define RadioView_h
+#include <mutex>
+
#include "Types.h"
#include "View.h"
#include "Color.h"
#include "SimObject.h"
#include "Text.h"
-#include "ThreadSync.h"
// +--------------------------------------------------------------------+
@@ -80,7 +81,7 @@ protected:
double msg_time[MAX_MSG];
static RadioView* radio_view;
- static ThreadSync sync;
+ static std::mutex sync;
};
#endif // RadioView_h
diff --git a/Stars45/RadioVox.cpp b/Stars45/RadioVox.cpp
index 2131aae..8942caf 100644
--- a/Stars45/RadioVox.cpp
+++ b/Stars45/RadioVox.cpp
@@ -11,6 +11,8 @@
View class for Radio Communications HUD Overlay
*/
+#include <mutex>
+
#include "RadioVox.h"
#include "RadioView.h"
#include "AudioConfig.h"
@@ -18,7 +20,6 @@
#include "DataLoader.h"
#include "Game.h"
#include "Sound.h"
-#include "ThreadSync.h"
// +====================================================================+
//
@@ -42,7 +43,7 @@ public:
bool shutdown;
HANDLE hthread;
List<RadioVox> queue;
- ThreadSync sync;
+ std::mutex sync;
};
static RadioVoxController* controller = 0;
@@ -100,7 +101,7 @@ RadioVoxController::UpdateThread()
void
RadioVoxController::Update()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (queue.size()) {
RadioVox* vox = queue.first();
@@ -116,7 +117,7 @@ RadioVoxController::Add(RadioVox* vox)
if (!vox || vox->sounds.isEmpty())
return false;
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (queue.size() < MAX_QUEUE) {
queue.append(vox);
diff --git a/Stars45/SoundCard.cpp b/Stars45/SoundCard.cpp
index c0b1368..1e54cce 100644
--- a/Stars45/SoundCard.cpp
+++ b/Stars45/SoundCard.cpp
@@ -11,6 +11,8 @@
Abstract sound card class
*/
+#include <mutex>
+
#include "SoundCard.h"
#include "Sound.h"
@@ -72,7 +74,7 @@ SoundCard::UpdateThread()
void
SoundCard::Update()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
ListIter<Sound> iter = sounds;
while (++iter) {
@@ -93,7 +95,7 @@ SoundCard::Update()
void
SoundCard::AddSound(Sound* s)
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (!sounds.contains(s))
sounds.append(s);
diff --git a/Stars45/SoundCard.h b/Stars45/SoundCard.h
index 4c4e2cb..a791c81 100644
--- a/Stars45/SoundCard.h
+++ b/Stars45/SoundCard.h
@@ -14,9 +14,10 @@
#ifndef SoundCard_h
#define SoundCard_h
+#include <mutex>
+
#include "Types.h"
#include "List.h"
-#include "ThreadSync.h"
// +--------------------------------------------------------------------+
@@ -68,7 +69,7 @@ protected:
HANDLE hthread;
SoundStatus status;
List<Sound> sounds;
- ThreadSync sync;
+ std::mutex sync;
};
#endif // SoundCard_h
diff --git a/Stars45/SoundD3D.cpp b/Stars45/SoundD3D.cpp
index 617c8d3..803b85a 100644
--- a/Stars45/SoundD3D.cpp
+++ b/Stars45/SoundD3D.cpp
@@ -17,6 +17,7 @@
#include <mmsystem.h>
#include <dsound.h>
+#include <mutex>
#include "SoundD3D.h"
#include "Game.h"
@@ -303,7 +304,7 @@ SoundCardD3D::SetListener(const Camera& cam, const Vec3& vel)
bool
SoundCardD3D::Pause()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
ListIter<Sound> iter = sounds;
while (++iter) {
@@ -321,7 +322,7 @@ SoundCardD3D::Pause()
bool
SoundCardD3D::Resume()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
ListIter<Sound> iter = sounds;
while (++iter) {
@@ -339,7 +340,7 @@ SoundCardD3D::Resume()
bool
SoundCardD3D::StopSoundEffects()
{
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
DWORD ok_sounds = (Sound::INTERFACE | Sound::OGGVORBIS | Sound::RESOURCE);
@@ -486,7 +487,7 @@ SoundD3D::Update()
return;
}
- AutoThreadSync a(sync);
+ const std::lock_guard<std::mutex> lock(sync);
if (sound_check) sound_check->Update(this);
diff --git a/Stars45/SoundD3D.h b/Stars45/SoundD3D.h
index b103302..a667182 100644
--- a/Stars45/SoundD3D.h
+++ b/Stars45/SoundD3D.h
@@ -14,11 +14,12 @@
#ifndef SoundD3D_h
#define SoundD3D_h
+#include <mutex>
+
//#define DIRECT_SOUND_3D
#include "SoundCard.h"
#include "Sound.h"
#include "Camera.h"
-#include "ThreadSync.h"
#include <stdio.h>
#include <dsound.h>
#include "vorbis/vorbisfile.h"
@@ -107,7 +108,7 @@ protected:
BYTE eos_latch;
bool moved;
- ThreadSync sync;
+ std::mutex sync;
OggVorbis_File* ov_file;
};