mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-08-17 08:46:24 +00:00
Revert "[Changed] Atomic queue to concurrent queue."
This reverts commit 8cdfe5314f14c4fc93a22d562c59c7c44e4c5ed3.
This commit is contained in:
parent
8cdfe5314f
commit
3821ce7c5d
@ -41,7 +41,7 @@ add_executable(${PROJECT_NAME}
|
|||||||
src/Memory/IPC.cpp include/Memory/IPC.h
|
src/Memory/IPC.cpp include/Memory/IPC.h
|
||||||
src/Logger.cpp include/Logger.h
|
src/Logger.cpp include/Logger.h
|
||||||
#src/gui/Gui.cpp
|
#src/gui/Gui.cpp
|
||||||
include/Json.h include/Memory/concurrentqueue.h
|
include/Json.h
|
||||||
src/gui/gifs.cpp src/gui/gifs.h
|
src/gui/gifs.cpp src/gui/gifs.h
|
||||||
src/Network/Http.cpp include/Http.h
|
src/Network/Http.cpp include/Http.h
|
||||||
src/Network/Server.cpp include/Server.h
|
src/Network/Server.cpp include/Server.h
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,15 +8,7 @@
|
|||||||
#include "Memory/BeamNG.h"
|
#include "Memory/BeamNG.h"
|
||||||
#include "Memory/Memory.h"
|
#include "Memory/Memory.h"
|
||||||
|
|
||||||
#include <vector>
|
atomic_queue::AtomicQueue2<std::string, 1000> AtomicQueue;
|
||||||
#include <Memory/concurrentqueue.h>
|
|
||||||
|
|
||||||
struct QueueTraits : public moodycamel::ConcurrentQueueDefaultTraits {
|
|
||||||
static const size_t BLOCK_SIZE = 4; // Use bigger blocks
|
|
||||||
static const size_t MAX_SUBQUEUE_SIZE = 1000;
|
|
||||||
};
|
|
||||||
|
|
||||||
moodycamel::ConcurrentQueue<std::string, QueueTraits> ConcQueue;
|
|
||||||
|
|
||||||
int BeamNG::lua_open_jit_D(lua_State* State) {
|
int BeamNG::lua_open_jit_D(lua_State* State) {
|
||||||
Memory::Print("Got lua State");
|
Memory::Print("Got lua State");
|
||||||
@ -63,7 +55,7 @@ int Game(lua_State* L) {
|
|||||||
|
|
||||||
int LuaPop(lua_State* L) {
|
int LuaPop(lua_State* L) {
|
||||||
std::string MSG;
|
std::string MSG;
|
||||||
if (ConcQueue.try_dequeue(MSG)) {
|
if (AtomicQueue.try_pop(MSG)) {
|
||||||
GELua::lua_push_fstring(L, "%s", MSG.c_str());
|
GELua::lua_push_fstring(L, "%s", MSG.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -84,21 +76,13 @@ void BeamNG::SendIPC(const std::string& Data) {
|
|||||||
IPCToLauncher->send(Data);
|
IPCToLauncher->send(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr <std::vector<std::string>> ptr1;
|
|
||||||
|
|
||||||
void BeamNG::IPCListener() {
|
void BeamNG::IPCListener() {
|
||||||
int TimeOuts = 0;
|
int TimeOuts = 0;
|
||||||
int QueueTimeOut = 0;
|
|
||||||
while(TimeOuts < 20) {
|
while(TimeOuts < 20) {
|
||||||
IPCFromLauncher->receive();
|
IPCFromLauncher->receive();
|
||||||
if (!IPCFromLauncher->receive_timed_out()) {
|
if (!IPCFromLauncher->receive_timed_out()) {
|
||||||
TimeOuts = 0;
|
TimeOuts = 0;
|
||||||
do {
|
AtomicQueue.push(IPCFromLauncher->msg());
|
||||||
QueueTimeOut++;
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds (500));
|
|
||||||
} while (QueueTimeOut < 10 && !ConcQueue.enqueue(IPCFromLauncher->msg()));
|
|
||||||
QueueTimeOut = 0;
|
|
||||||
|
|
||||||
IPCFromLauncher->confirm_receive();
|
IPCFromLauncher->confirm_receive();
|
||||||
} else TimeOuts++;
|
} else TimeOuts++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user