mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-29 21:32:41 +00:00
Hopefully fixes thread local issues in older versions of macOS.
This commit is contained in:
parent
6c96998ace
commit
b101af4569
@ -1,16 +1,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <core/sdk/IPlaybackRemote.h>
|
#include <core/sdk/IPlaybackRemote.h>
|
||||||
#include <core/sdk/IPlugin.h>
|
#include <core/sdk/IPlugin.h>
|
||||||
#include <core/sdk/IPreferences.h>
|
#include <core/sdk/IPreferences.h>
|
||||||
#include <core/sdk/ISimpleDataProvider.h>
|
#include <core/sdk/ISimpleDataProvider.h>
|
||||||
#else
|
|
||||||
#include <musikcube/core/sdk/IPlaybackRemote.h>
|
|
||||||
#include <musikcube/core/sdk/IPlugin.h>
|
|
||||||
#include <musikcube/core/sdk/IPreferences.h>
|
|
||||||
#include <musikcube/core/sdk/ISimpleDataProvider.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <websocketpp/config/asio_no_tls.hpp>
|
#include <websocketpp/config/asio_no_tls.hpp>
|
||||||
#include <websocketpp/server.hpp>
|
#include <websocketpp/server.hpp>
|
||||||
@ -57,6 +50,12 @@ static IPreferences* preferences = nullptr;
|
|||||||
static ISimpleDataProvider* dataProvider = nullptr;
|
static ISimpleDataProvider* dataProvider = nullptr;
|
||||||
static int nextId = 0;
|
static int nextId = 0;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
__thread char threadLocalBuffer[4096];
|
||||||
|
#else
|
||||||
|
thread_local char threadLocalBuffer[4096];
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace prefs {
|
namespace prefs {
|
||||||
static const std::string port = "port";
|
static const std::string port = "port";
|
||||||
}
|
}
|
||||||
@ -790,9 +789,8 @@ class PlaybackRemote : public IPlaybackRemote {
|
|||||||
|
|
||||||
template <typename MetadataT>
|
template <typename MetadataT>
|
||||||
std::string GetMetadataString(MetadataT* metadata, const std::string& key) {
|
std::string GetMetadataString(MetadataT* metadata, const std::string& key) {
|
||||||
thread_local char buffer[4096];
|
metadata->GetValue(key.c_str(), threadLocalBuffer, sizeof(threadLocalBuffer));
|
||||||
metadata->GetValue(key.c_str(), buffer, sizeof(buffer));
|
return std::string(threadLocalBuffer);
|
||||||
return std::string(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MetadataT>
|
template <typename MetadataT>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user