aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-07-09 15:52:13 +0200
committerDavid 'Digit' Turner <digit@google.com>2014-07-09 18:16:17 +0200
commit40cc9f9d50e998b0ce965b261ecf4d206a58618e (patch)
tree66272ee1b92a2267cc832618b43a59d650099e54 /emulator/opengl/host/libs
parent242a075e3256fc7f369f0e5f93fd2ae91c255774 (diff)
downloadsdk-40cc9f9d50e998b0ce965b261ecf4d206a58618e.zip
sdk-40cc9f9d50e998b0ce965b261ecf4d206a58618e.tar.gz
sdk-40cc9f9d50e998b0ce965b261ecf4d206a58618e.tar.bz2
emulator/opengl: refactor Thread class.
+ Add unit test. Change-Id: I26d84cf590f6bfff3304be3f42dc0196bcc7f6d2
Diffstat (limited to 'emulator/opengl/host/libs')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp5
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.h6
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp4
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.h6
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/render_api.cpp3
5 files changed, 11 insertions, 13 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
index de28f8f..53c65ee 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
@@ -77,7 +77,7 @@ RenderServer *RenderServer::create(char* addr, size_t addrLen)
return server;
}
-int RenderServer::Main()
+intptr_t RenderServer::main()
{
RenderThreadsSet threads;
@@ -146,8 +146,7 @@ int RenderServer::Main()
for (RenderThreadsSet::iterator t = threads.begin();
t != threads.end();
t++) {
- int exitStatus;
- (*t)->wait(&exitStatus);
+ (*t)->wait(NULL);
delete (*t);
}
threads.clear();
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
index ff63c94..8be8a17 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
@@ -18,15 +18,15 @@
#include "SocketStream.h"
#include "emugl/common/mutex.h"
-#include "osThread.h"
+#include "emugl/common/thread.h"
-class RenderServer : public osUtils::Thread
+class RenderServer : public emugl::Thread
{
public:
static RenderServer *create(char* addr, size_t addrLen);
virtual ~RenderServer();
- virtual int Main();
+ virtual intptr_t main();
bool isExiting() const { return m_exiting; }
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
index 19d6c1f..3dcfdb5 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
@@ -26,7 +26,7 @@
#define STREAM_BUFFER_SIZE 4*1024*1024
RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock) :
- osUtils::Thread(),
+ emugl::Thread(),
m_lock(lock),
m_stream(stream),
m_finished(false)
@@ -43,7 +43,7 @@ RenderThread *RenderThread::create(IOStream *p_stream, emugl::Mutex *lock)
return new RenderThread(p_stream, lock);
}
-int RenderThread::Main()
+intptr_t RenderThread::main()
{
RenderThreadInfo tInfo;
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
index e94d782..c1f919a 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
@@ -21,9 +21,9 @@
#include "renderControl_dec.h"
#include "emugl/common/mutex.h"
-#include "osThread.h"
+#include "emugl/common/thread.h"
-class RenderThread : public osUtils::Thread
+class RenderThread : public emugl::Thread
{
public:
static RenderThread* create(IOStream* p_stream, emugl::Mutex* mutex);
@@ -32,7 +32,7 @@ public:
private:
RenderThread(IOStream* p_stream, emugl::Mutex* mutex);
- virtual int Main();
+ virtual intptr_t main();
private:
emugl::Mutex *m_lock;
diff --git a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
index 5c9ffb1..42df668 100644
--- a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
@@ -243,8 +243,7 @@ int stopOpenGLRenderer(void)
else if (s_renderThread) {
// wait for the thread to exit
- int status;
- ret = s_renderThread->wait(&status);
+ ret = s_renderThread->wait(NULL);
delete s_renderThread;
s_renderThread = NULL;