mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 15:11:20 +02:00
- added a special thread to calculate interpolation to try to improve performance
This commit is contained in:
@@ -31,19 +31,19 @@ protected:
|
||||
bool quit;
|
||||
bool running;
|
||||
|
||||
void setRunningStatus(bool value);
|
||||
void setQuitStatus(bool value);
|
||||
virtual void setRunningStatus(bool value);
|
||||
virtual void setQuitStatus(bool value);
|
||||
|
||||
public:
|
||||
BaseThread();
|
||||
~BaseThread();
|
||||
virtual void execute()=0;
|
||||
|
||||
void signalQuit();
|
||||
bool getQuitStatus();
|
||||
bool getRunningStatus();
|
||||
virtual void signalQuit();
|
||||
virtual bool getQuitStatus();
|
||||
virtual bool getRunningStatus();
|
||||
static void shutdownAndWait(BaseThread *ppThread);
|
||||
void shutdownAndWait();
|
||||
virtual void shutdownAndWait();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
82
source/shared_lib/include/platform/sdl/thread.h
Normal file
82
source/shared_lib/include/platform/sdl/thread.h
Normal file
@@ -0,0 +1,82 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_THREAD_H_
|
||||
#define _SHARED_PLATFORM_THREAD_H_
|
||||
|
||||
#include <SDL_thread.h>
|
||||
#include <SDL_mutex.h>
|
||||
|
||||
// =====================================================
|
||||
// class Thread
|
||||
// =====================================================
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
class Thread{
|
||||
public:
|
||||
enum Priority {
|
||||
pIdle = 0,
|
||||
pLow = 1,
|
||||
pNormal = 2,
|
||||
pHigh = 3,
|
||||
pRealTime = 4
|
||||
};
|
||||
|
||||
private:
|
||||
SDL_Thread* thread;
|
||||
|
||||
public:
|
||||
virtual ~Thread() {}
|
||||
|
||||
void start();
|
||||
virtual void execute()=0;
|
||||
void setPriority(Thread::Priority threadPriority);
|
||||
void suspend();
|
||||
void resume();
|
||||
|
||||
private:
|
||||
static int beginExecution(void *param);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Mutex
|
||||
// =====================================================
|
||||
|
||||
class Mutex{
|
||||
private:
|
||||
SDL_mutex* mutex;
|
||||
|
||||
public:
|
||||
Mutex();
|
||||
~Mutex();
|
||||
void p();
|
||||
void v();
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Semaphore
|
||||
// =====================================================
|
||||
|
||||
class Semaphore {
|
||||
private:
|
||||
SDL_sem* semaphore;
|
||||
|
||||
public:
|
||||
Semaphore(Uint32 initialValue = 0);
|
||||
~Semaphore();
|
||||
void signal();
|
||||
int waitTillSignalled();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user