mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-08-17 16:57:11 +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/Logger.cpp include/Logger.h
|
||||
#src/gui/Gui.cpp
|
||||
include/Json.h include/Memory/concurrentqueue.h
|
||||
include/Json.h
|
||||
src/gui/gifs.cpp src/gui/gifs.h
|
||||
src/Network/Http.cpp include/Http.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/Memory.h"
|
||||
|
||||
#include <vector>
|
||||
#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;
|
||||
atomic_queue::AtomicQueue2<std::string, 1000> AtomicQueue;
|
||||
|
||||
int BeamNG::lua_open_jit_D(lua_State* State) {
|
||||
Memory::Print("Got lua State");
|
||||
@ -63,7 +55,7 @@ int Game(lua_State* L) {
|
||||
|
||||
int LuaPop(lua_State* L) {
|
||||
std::string MSG;
|
||||
if (ConcQueue.try_dequeue(MSG)) {
|
||||
if (AtomicQueue.try_pop(MSG)) {
|
||||
GELua::lua_push_fstring(L, "%s", MSG.c_str());
|
||||
return 1;
|
||||
}
|
||||
@ -84,21 +76,13 @@ void BeamNG::SendIPC(const std::string& Data) {
|
||||
IPCToLauncher->send(Data);
|
||||
}
|
||||
|
||||
std::unique_ptr <std::vector<std::string>> ptr1;
|
||||
|
||||
void BeamNG::IPCListener() {
|
||||
int TimeOuts = 0;
|
||||
int QueueTimeOut = 0;
|
||||
while(TimeOuts < 20) {
|
||||
IPCFromLauncher->receive();
|
||||
if (!IPCFromLauncher->receive_timed_out()) {
|
||||
TimeOuts = 0;
|
||||
do {
|
||||
QueueTimeOut++;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds (500));
|
||||
} while (QueueTimeOut < 10 && !ConcQueue.enqueue(IPCFromLauncher->msg()));
|
||||
QueueTimeOut = 0;
|
||||
|
||||
AtomicQueue.push(IPCFromLauncher->msg());
|
||||
IPCFromLauncher->confirm_receive();
|
||||
} else TimeOuts++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user