aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
Diffstat (limited to 'emulator')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp3
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.h2
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp19
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.h7
4 files changed, 17 insertions, 14 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
index 0acb307..de28f8f 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
@@ -27,6 +27,7 @@
typedef std::set<RenderThread *> RenderThreadsSet;
RenderServer::RenderServer() :
+ m_lock(),
m_listenSock(NULL),
m_exiting(false)
{
@@ -102,7 +103,7 @@ int RenderServer::Main()
break;
}
- RenderThread *rt = RenderThread::create(stream);
+ RenderThread *rt = RenderThread::create(stream, &m_lock);
if (!rt) {
fprintf(stderr,"Failed to create RenderThread\n");
delete stream;
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
index 18b4442..ff63c94 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
@@ -17,6 +17,7 @@
#define _LIB_OPENGL_RENDER_RENDER_SERVER_H
#include "SocketStream.h"
+#include "emugl/common/mutex.h"
#include "osThread.h"
class RenderServer : public osUtils::Thread
@@ -33,6 +34,7 @@ private:
RenderServer();
private:
+ emugl::Mutex m_lock;
SocketStream *m_listenSock;
bool m_exiting;
};
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
index 9ae2a43..19d6c1f 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
@@ -25,9 +25,10 @@
#define STREAM_BUFFER_SIZE 4*1024*1024
-RenderThread::RenderThread() :
+RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock) :
osUtils::Thread(),
- m_stream(NULL),
+ m_lock(lock),
+ m_stream(stream),
m_finished(false)
{
}
@@ -37,16 +38,9 @@ RenderThread::~RenderThread()
delete m_stream;
}
-RenderThread *RenderThread::create(IOStream *p_stream)
+RenderThread *RenderThread::create(IOStream *p_stream, emugl::Mutex *lock)
{
- RenderThread *rt = new RenderThread();
- if (!rt) {
- return NULL;
- }
-
- rt->m_stream = p_stream;
-
- return rt;
+ return new RenderThread(p_stream, lock);
}
int RenderThread::Main()
@@ -113,6 +107,7 @@ int RenderThread::Main()
do {
progress = false;
+ m_lock->lock();
//
// try to process some of the command buffer using the GLESv1 decoder
//
@@ -141,6 +136,8 @@ int RenderThread::Main()
progress = true;
}
+ m_lock->unlock();
+
} while( progress );
}
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
index 80a9aef..e94d782 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
@@ -19,20 +19,23 @@
#include "IOStream.h"
#include "GLDecoder.h"
#include "renderControl_dec.h"
+
+#include "emugl/common/mutex.h"
#include "osThread.h"
class RenderThread : public osUtils::Thread
{
public:
- static RenderThread *create(IOStream *p_stream);
+ static RenderThread* create(IOStream* p_stream, emugl::Mutex* mutex);
virtual ~RenderThread();
bool isFinished() const { return m_finished; }
private:
- RenderThread();
+ RenderThread(IOStream* p_stream, emugl::Mutex* mutex);
virtual int Main();
private:
+ emugl::Mutex *m_lock;
IOStream *m_stream;
renderControl_decoder_context_t m_rcDec;
bool m_finished;