From Norman Vine, updates to TXP plugin so that the Cygwin build uses pthreads.
This commit is contained in:
@@ -34,7 +34,7 @@ using namespace txp;
|
||||
using namespace osg;
|
||||
|
||||
// disable 'this' used in base pointer initilialization..
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(WIN32) && !defined(__GNUC__)
|
||||
#pragma warning( disable : 4355 )
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef WAIT_BLOCK_H
|
||||
#define WAIT_BLOCK_H
|
||||
#ifndef WIN32
|
||||
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
#include <pthread.h>
|
||||
|
||||
namespace osgTXP {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <conio.h>
|
||||
#else
|
||||
@@ -124,7 +128,7 @@ void osgLockMutex(ThreadMutex &mtx)
|
||||
// --- Either thread ---
|
||||
void osgUnLockMutex(ThreadMutex &mtx)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
ReleaseMutex(mtx);
|
||||
#else
|
||||
pthread_mutex_unlock( &mtx );
|
||||
@@ -135,7 +139,7 @@ void osgUnLockMutex(ThreadMutex &mtx)
|
||||
// --- Either thread (only used in paging thread) ---
|
||||
void osgWaitEvent(ThreadEvent &ev)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
WaitForSingleObject( ev, INFINITE);
|
||||
#else
|
||||
ev.wait();
|
||||
@@ -146,7 +150,7 @@ void osgWaitEvent(ThreadEvent &ev)
|
||||
// --- Either thread (only used in main thread) ---
|
||||
void osgSetEvent(ThreadEvent &ev)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
SetEvent(ev);
|
||||
#else
|
||||
ev.release();
|
||||
@@ -156,7 +160,7 @@ void osgSetEvent(ThreadEvent &ev)
|
||||
// Windows specific thread function.
|
||||
// This just fires up our own loop
|
||||
// --- Paging Thread ---
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
DWORD WINAPI ThreadFunc( LPVOID lpParam )
|
||||
{
|
||||
OSGPageManager *myPager = (OSGPageManager *)lpParam;
|
||||
@@ -182,7 +186,7 @@ bool OSGPageManager::StartThread(ThreadMode mode,ThreadID &newThread)
|
||||
{
|
||||
positionValid = false;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
// Create the event we'll use to wake up the pager thread when the location changes
|
||||
locationChangeEvent = CreateEvent(NULL,false,false,"Location Change Event");
|
||||
|
||||
@@ -228,7 +232,7 @@ bool OSGPageManager::StartThread(ThreadMode mode,ThreadID &newThread)
|
||||
*/
|
||||
bool OSGPageManager::EndThread()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#else
|
||||
// Need a handle to the thread ID here.
|
||||
//pthread_cancel( ?newThread? );
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
#if defined(__CYGWIN__) || !defined(WIN32)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace txp
|
||||
Fill this in for your specific platform.
|
||||
Should be water ID you use for threads.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
typedef HANDLE ThreadID;
|
||||
typedef HANDLE ThreadMutex;
|
||||
typedef HANDLE ThreadEvent;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define ALIGNMENT_WORKAROUND false
|
||||
#else
|
||||
#define ALIGNMENT_WORKAROUND true
|
||||
|
||||
@@ -74,7 +74,7 @@ protected:
|
||||
private:
|
||||
// Note: Just how slow is a map<> anyway?
|
||||
// This usage is self-contained and could be replaced with an array
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
typedef std::map<trpgToken,trpgr_Token> tok_map;
|
||||
#else
|
||||
typedef std::map<trpgToken,trpgr_Token,std::less<trpgToken> > tok_map;
|
||||
|
||||
@@ -203,7 +203,7 @@ protected:
|
||||
// {group:Demonstration Scene Graph}
|
||||
TX_EXDECL class TX_CLDECL trpgSceneGraphParser : public trpgSceneParser {
|
||||
public:
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
typedef std::map<int,trpgReadGroupBase *> GroupMap;
|
||||
#else
|
||||
typedef std::map<int,trpgReadGroupBase *,std::less<int> > GroupMap;
|
||||
|
||||
@@ -38,18 +38,29 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
// Microsoft Developer warnings that annoy me
|
||||
#pragma warning ( disable : 4251)
|
||||
#pragma warning ( disable : 4275)
|
||||
#pragma warning ( disable : 4786)
|
||||
#endif
|
||||
|
||||
// Somewhat system independent file deletion macro
|
||||
#define TRPGDELETEFILE(file) DeleteFile((file))
|
||||
#ifdef __CYGWIN__
|
||||
# define TRPGDELETEFILE(file) remove((file))
|
||||
#else
|
||||
# define TRPGDELETEFILE(file) DeleteFile((file))
|
||||
#endif
|
||||
|
||||
#ifndef int64
|
||||
// 64 bit long value. Need this for really big files.
|
||||
typedef __int64 int64;
|
||||
// 64 bit long value. Need this for really big files.
|
||||
#ifdef __GNUC__
|
||||
typedef long long int64;
|
||||
#else
|
||||
typedef __int64 int64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#else // Unix
|
||||
|
||||
|
||||
Reference in New Issue
Block a user