pull/306/merge
Damiano 4 years ago committed by GitHub
commit 35ba5a5f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -333,11 +333,6 @@ LCC predefines the following:
# define POSH_OS_STRING "GameCube"
#endif
#if defined __MINGW32__
# define POSH_OS_MINGW 1
# define POSH_OS_STRING "MinGW"
#endif
#if defined GO32 && defined DJGPP && defined __MSDOS__
# define POSH_OS_GO32 1
# define POSH_OS_STRING "GO32/MS-DOS"
@ -427,7 +422,14 @@ LCC predefines the following:
# define POSH_OS_STRING "XBOX"
#endif
#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__
#if defined __MINGW32__ || defined __MINGW64__
# define POSH_OS_MINGW 1
# if defined _WIN64 || defined __MINGW64__
# define POSH_OS_MINGW64
# define POSH_OS_WIN64 1
# endif
# define POSH_OS_STRING "MinGW"
#elif defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__
# define POSH_OS_WIN32 1
# if !defined POSH_OS_XBOX
# if defined _WIN64

@ -1,4 +1,4 @@
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
#include "Debug.h"
#include "Array.inl"
@ -949,7 +949,7 @@ int nvAbort(const char * exp, const char * file, int line, const char * func/*=N
// Abnormal termination. Create mini dump and output call stack.
void debug::terminate(int code)
{
#if NV_OS_WIN32
#if NV_OS_WIN32 && NV_CC_MSVC
EnterCriticalSection(&s_handler_critical_section);
writeMiniDump(NULL);

@ -1,4 +1,4 @@
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
#pragma once
#ifndef NV_CORE_H
@ -52,6 +52,10 @@
# define NV_OS_UNIX 1
#elif defined POSH_OS_CYGWIN32
# define NV_OS_CYGWIN 1
#elif defined POSH_OS_MINGW64
# define NV_OS_MINGW 1
# define NV_OS_WIN32 1
# define NV_OS_WIN64 1
#elif defined POSH_OS_MINGW
# define NV_OS_MINGW 1
# define NV_OS_WIN32 1
@ -79,7 +83,7 @@
// Threading:
// some platforms don't implement __thread or similar for thread-local-storage
#if NV_OS_UNIX || NV_OS_ORBIS || NV_OS_IOS
#if NV_OS_UNIX || NV_OS_ORBIS || NV_OS_IOS || __MINGW32__ || __MINGW64__
# define NV_OS_USE_PTHREAD 1
# if 0 //Apple finally added TLS support to iOS!// NV_OS_IOS
# define NV_OS_HAS_TLS_QUALIFIER 0

@ -8,7 +8,11 @@
#include <float.h>
#if !NV_CC_MSVC && !NV_OS_ORBIS
#include <alloca.h>
#if defined __MINGW32__ || defined __MINGW64__
#include <malloc.h>
#else
#include <alloca.h>
#endif
#endif
using namespace nv;
@ -484,4 +488,3 @@ double invert(Mat4& B, const Mat4& m)
#endif // 0

@ -2,15 +2,15 @@
#include "Event.h"
#if NV_OS_WIN32
#include "Win32.h"
#elif NV_OS_USE_PTHREAD
#if NV_OS_USE_PTHREAD
#include <pthread.h>
#elif NV_OS_WIN32
#include "Win32.h"
#endif
using namespace nv;
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
struct Event::Private {
HANDLE handle;

@ -2,15 +2,16 @@
#include "Mutex.h"
#if NV_OS_WIN32
#include "Win32.h"
#elif NV_OS_USE_PTHREAD
#if NV_OS_USE_PTHREAD
#include <pthread.h>
#include <errno.h> // EBUSY
#elif NV_OS_WIN32
#include "Win32.h"
#endif // NV_OS
#if NV_USE_TELEMETRY3
@ -23,7 +24,7 @@ extern HTELEMETRY tmContext;
using namespace nv;
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
struct Mutex::Private {
CRITICAL_SECTION mutex;
@ -53,7 +54,7 @@ void Mutex::lock()
TmU64 matcher;
tmTryLockEx(tmContext, &matcher, 100/*0.1 ms*/, __FILE__, __LINE__, this, "blocked");
#endif
EnterCriticalSection(&m->mutex);
#if NV_USE_TELEMETRY3

@ -2,11 +2,11 @@
#include "Thread.h"
#if NV_OS_WIN32
#include "Win32.h"
#elif NV_OS_USE_PTHREAD
#if NV_OS_USE_PTHREAD
#include <pthread.h>
#include <unistd.h> // usleep
#elif NV_OS_WIN32
#include "Win32.h"
#endif
#include "nvcore/StrLib.h"
@ -23,10 +23,10 @@ using namespace nv;
struct Thread::Private
{
#if NV_OS_WIN32
HANDLE thread;
#elif NV_OS_USE_PTHREAD
#if NV_OS_USE_PTHREAD
pthread_t thread;
#elif NV_OS_WIN32
HANDLE thread;
#endif
ThreadFunc * func;
@ -35,7 +35,7 @@ struct Thread::Private
};
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
unsigned long __stdcall threadFunc(void * arg) {
Thread::Private * thread = (Thread::Private *)arg;
@ -115,7 +115,7 @@ void Thread::start(ThreadFunc * func, void * arg)
p->func = func;
p->arg = arg;
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
DWORD threadId;
p->thread = CreateThread(NULL, 0, threadFunc, p.ptr(), 0, &threadId);
//p->thread = (HANDLE)_beginthreadex (0, 0, threadFunc, p.ptr(), 0, NULL); // @@ So that we can call CRT functions...
@ -136,7 +136,7 @@ void Thread::start(ThreadFunc * func, void * arg)
void Thread::wait()
{
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
DWORD status = WaitForSingleObject (p->thread, INFINITE);
nvCheck (status == WAIT_OBJECT_0);
BOOL ok = CloseHandle (p->thread);
@ -151,7 +151,7 @@ void Thread::wait()
bool Thread::isRunning () const
{
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
return p->thread != NULL;
#elif NV_OS_USE_PTHREAD
return p->thread != 0;
@ -165,7 +165,7 @@ bool Thread::isRunning () const
/*static*/ void Thread::yield()
{
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
SwitchToThread();
#elif NV_OS_USE_PTHREAD
int result = sched_yield();
@ -175,7 +175,7 @@ bool Thread::isRunning () const
/*static*/ void Thread::sleep(uint ms)
{
#if NV_OS_WIN32
#if NV_OS_WIN32 && !NV_OS_MINGW
Sleep(ms);
#elif NV_OS_USE_PTHREAD
usleep(1000 * ms);
@ -207,4 +207,3 @@ bool Thread::isRunning () const
}
//#endif
}

@ -25,6 +25,10 @@
#include <syslog.h>
#endif
#if defined __MINGW32__ || defined __MINGW64__
#include <intrin.h>
#endif
using namespace nv;
#if NV_OS_WIN32

@ -29,7 +29,7 @@
// Function linkage
#if NVTT_SHARED
#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__ || defined __MINGW64__
# ifdef NVTT_EXPORTS
# define NVTT_API __declspec(dllexport)
# else

Loading…
Cancel
Save