Fix massive lag spike when starting on haiku

This commit is contained in:
Li
2026-04-20 10:36:03 +00:00
parent 9ba3fabfb6
commit f8e7c0f80f
7 changed files with 25 additions and 17 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ out/
bin/ bin/
lib/ lib/
build-apk/ build-apk/
build-haiku/
cmake-build-*/ cmake-build-*/
CMakeFiles/ CMakeFiles/
CMakeCache.txt CMakeCache.txt

View File

@@ -351,7 +351,8 @@ StartupResult RakPeer::Startup( unsigned short maxConnections, SocketDescriptor
#if defined(_WIN32) #if defined(_WIN32)
threadPriority=0; threadPriority=0;
#elif defined(__HAIKU__)
threadPriority=40;
#else #else
threadPriority=1000; threadPriority=1000;
#endif #endif

View File

@@ -17,8 +17,8 @@ using namespace RakNet;
#endif #endif
#elif defined(__HAIKU__)
#include <kernel/OS.h>
#else #else
#include <pthread.h> #include <pthread.h>
#endif #endif
@@ -93,9 +93,10 @@ int RakThread::Create( void* start_address( void* ), void *arglist, int priority
#elif defined(__HAIKU__)
thread_id threadHandle = spawn_thread((thread_func)start_address, "RakThread", priority, arglist);
int res = resume_thread(threadHandle);
return res == B_OK ? 0 : 1;
#else #else
pthread_t threadHandle; pthread_t threadHandle;
// Create thread linux // Create thread linux

View File

@@ -1665,7 +1665,7 @@ void GetMyIP_Win32( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
} }
} }
// #else // #else
/*
void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] ) void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
{ {
struct ifaddrs *ifaddr, *ifa; struct ifaddrs *ifaddr, *ifa;
@@ -1716,7 +1716,7 @@ void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
freeifaddrs(ifaddr); freeifaddrs(ifaddr);
} }
*/
@@ -1724,10 +1724,10 @@ void SocketLayer::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_ID
{ {
#if defined(_WIN32) #if defined(_WIN32)
GetMyIP_Win32(addresses); GetMyIP_Win32(addresses);
#elif defined(__HAIKU__)
GetMyIP_Linux(addresses);
#else #else
// GetMyIP_Linux(addresses); // GetMyIP_Linux(addresses);
GetMyIP_Win32(addresses); GetMyIP_Win32(addresses);

View File

@@ -351,7 +351,8 @@ StartupResult RakPeer::Startup( unsigned short maxConnections, SocketDescriptor
#if defined(_WIN32) #if defined(_WIN32)
threadPriority=0; threadPriority=0;
#elif defined(__HAIKU__)
threadPriority=40;
#else #else
threadPriority=1000; threadPriority=1000;
#endif #endif

View File

@@ -19,6 +19,8 @@ using namespace RakNet;
#elif defined(__HAIKU__)
#include <kernel/OS.h>
#else #else
#include <pthread.h> #include <pthread.h>
#endif #endif
@@ -92,10 +94,10 @@ int RakThread::Create( void* start_address( void* ), void *arglist, int priority
#elif defined(__HAIKU__)
thread_id threadHandle = spawn_thread((thread_func)start_address, "RakThread", priority, arglist);
int res = resume_thread(threadHandle);
return res == B_OK ? 0 : 1;
#else #else
pthread_t threadHandle; pthread_t threadHandle;
// Create thread linux // Create thread linux

View File

@@ -1665,7 +1665,7 @@ void GetMyIP_Win32( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
} }
} }
// #else // #else
/*
void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] ) void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
{ {
struct ifaddrs *ifaddr, *ifa; struct ifaddrs *ifaddr, *ifa;
@@ -1716,7 +1716,7 @@ void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
freeifaddrs(ifaddr); freeifaddrs(ifaddr);
} }
*/
@@ -1728,6 +1728,8 @@ void SocketLayer::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_ID
#if defined(_WIN32) #if defined(_WIN32)
GetMyIP_Win32(addresses); GetMyIP_Win32(addresses);
#elif defined(__HAIKU__)
GetMyIP_Linux(addresses);
#else #else
// GetMyIP_Linux(addresses); // GetMyIP_Linux(addresses);
GetMyIP_Win32(addresses); GetMyIP_Win32(addresses);