Remove Superfluous Mutexes

This commit is contained in:
TheBrokenRail 2022-07-13 19:32:08 -04:00
parent c87a6fa3c0
commit 9fe6a2fb39
5 changed files with 5 additions and 16 deletions

View File

@ -37,5 +37,5 @@ TRUE Improved Title Background
TRUE Force Touch GUI Button Behavior
TRUE Improved Button Hover Behavior
TRUE Implement Create World Dialog
FALSE Remove Forced GUI Lag (Cam Break Server Joining)
FALSE Remove Forced GUI Lag (Can Break Joining Servers)
TRUE Add Buckets

View File

@ -23,7 +23,7 @@ if(BUILD_ARM_COMPONENTS)
endif()
# Link
target_link_libraries(media-layer-core PUBLIC media-layer-headers PUBLIC reborn-util PUBLIC GLESv1_CM PUBLIC pthread PUBLIC dl)
target_link_libraries(media-layer-core PUBLIC media-layer-headers PUBLIC reborn-util PUBLIC GLESv1_CM PUBLIC dl)
if(NOT MCPI_HEADLESS_MODE)
# OpenAL
find_library(OPENAL_LIBRARY NAMES openal REQUIRED)

View File

@ -1,5 +1,4 @@
#include <cstdlib>
#include <pthread.h>
#include <vector>
#include <SDL/SDL.h>
@ -15,7 +14,6 @@ int SDL_Init(__attribute__((unused)) uint32_t flags) {
// Event Queue
static pthread_mutex_t queue_mutex = PTHREAD_MUTEX_INITIALIZER;
static std::vector<SDL_Event> queue;
int SDL_PollEvent(SDL_Event *event) {
@ -23,7 +21,6 @@ int SDL_PollEvent(SDL_Event *event) {
_media_handle_SDL_PollEvent();
// Poll Event
pthread_mutex_lock(&queue_mutex);
int ret;
if (queue.size() > 0) {
*event = queue[0];
@ -32,14 +29,11 @@ int SDL_PollEvent(SDL_Event *event) {
} else {
ret = 0;
}
pthread_mutex_unlock(&queue_mutex);
return ret;
}
int SDL_PushEvent(SDL_Event *event) {
pthread_mutex_lock(&queue_mutex);
queue.push_back(*event);
pthread_mutex_unlock(&queue_mutex);
return 1;
}

View File

@ -1,7 +1,6 @@
#include <cerrno>
#include <cstring>
#include <unistd.h>
#include <pthread.h>
#include <csignal>
#include <sys/wait.h>
#include <fcntl.h>
@ -156,16 +155,12 @@ unsigned char _get_unique_id(const char *name) {
return get_unique_ids()[name]; // Assume ID Exists
}
// The Proxy Is Single-Threaded
static pthread_mutex_t proxy_mutex = PTHREAD_MUTEX_INITIALIZER;
// Proxy Call Functions
void _start_proxy_call(unsigned char call_id) {
// Lock Proxy
pthread_mutex_lock(&proxy_mutex);
// Start Call
write_byte(call_id);
}
void end_proxy_call() {
// Flush Write Cache
flush_write_cache();
// Release Proxy
pthread_mutex_unlock(&proxy_mutex);
}

View File

@ -275,7 +275,7 @@ void init_misc() {
}
// Remove Forced GUI Lag
if (feature_has("Remove Forced GUI Lag (Cam Break Server Joining)", server_enabled)) {
if (feature_has("Remove Forced GUI Lag (Can Break Joining Servers)", server_enabled)) {
overwrite_calls((void *) sleepMs, (void *) nop);
}