commit x64 compilation from lulu cause the other branch dont seems to compile properly at home

This commit is contained in:
2026-07-17 16:08:20 +02:00
parent c0f3eeb00d
commit 0efa4ee6f7
625 changed files with 117283 additions and 4426 deletions

View File

@ -0,0 +1,90 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include "thread/mutex.h"
#include "alloc/ialloc.h"
using namespace GS::Threading;
#if __PLATFORM_WINDOWS__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//------------------------------------------------------------------------------
bool Mutex::TryLock()
{ return asbool(TryEnterCriticalSection((LPCRITICAL_SECTION)mutex)); }
void Mutex::Lock()
{
if (mutex)
EnterCriticalSection((LPCRITICAL_SECTION)mutex);
}
void Mutex::Unlock()
{
if (mutex)
LeaveCriticalSection((LPCRITICAL_SECTION)mutex);
}
Mutex::Mutex()
{
mutex = new CRITICAL_SECTION;
InitializeCriticalSection((LPCRITICAL_SECTION)mutex);
}
Mutex::~Mutex()
{
DeleteCriticalSection((LPCRITICAL_SECTION)mutex);
_safe_delete(mutex);
}
//------------------------------------------------------------------------------
#elif __PLATFORM_POSIX__
#include <errno.h>
//------------------------------------------------------------------------------
bool Mutex::TryLock()
{ return pthread_mutex_trylock(&mutex) != EBUSY ? true : false; }
void Mutex::Lock()
{ pthread_mutex_lock(&mutex); }
void Mutex::Unlock()
{ pthread_mutex_unlock(&mutex); }
Mutex::Mutex()
{ pthread_mutex_init(&mutex, NULL); }
Mutex::~Mutex()
{ pthread_mutex_destroy(&mutex); }
//------------------------------------------------------------------------------
#elif __PLATFORM_NINTENDO_WII__
//------------------------------------------------------------------------------
bool Mutex::TryLock()
{ return OSTryLockMutex(&mutex); }
void Mutex::Lock()
{ OSLockMutex(&mutex); }
void Mutex::Unlock()
{ OSUnlockMutex(&mutex); }
Mutex::Mutex()
{ OSInitMutex(&mutex); }
Mutex::~Mutex()
{}
//------------------------------------------------------------------------------
#else
//------------------------------------------------------------------------------
bool Mutex::TryLock()
{ return true; }
void Mutex::Lock()
{}
void Mutex::Unlock()
{}
Mutex::Mutex()
{}
Mutex::~Mutex()
{}
//------------------------------------------------------------------------------
#endif