task: Change to C++03 conventions to support older compilers. Related to commit 5428763.

This commit is contained in:
rogerman 2021-08-30 12:39:28 -07:00
parent ac472c13ef
commit 63702ff6bd
4 changed files with 32 additions and 32 deletions

View File

@ -1797,13 +1797,13 @@ SoftRasterizerRenderer::SoftRasterizerRenderer()
_rasterizerUnit[i].SetSLI(_threadPostprocessParam[i].startLine, _threadPostprocessParam[i].endLine, false); _rasterizerUnit[i].SetSLI(_threadPostprocessParam[i].startLine, _threadPostprocessParam[i].endLine, false);
_rasterizerUnit[i].SetRenderer(this); _rasterizerUnit[i].SetRenderer(this);
char name[16];
snprintf(name, 16, "rasterizer %d", (int)i);
#ifdef DESMUME_COCOA #ifdef DESMUME_COCOA
// The Cocoa port takes advantage of hand-optimized thread priorities // The Cocoa port takes advantage of hand-optimized thread priorities
// to help stabilize performance when running SoftRasterizer. // to help stabilize performance when running SoftRasterizer.
_task[i].start(false, 43); _task[i].start(false, 43, name);
#else #else
char name[16];
snprintf(name, 16, "rasterizer %d", i);
_task[i].start(false, 0, name); _task[i].start(false, 0, name);
#endif #endif
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2016 DeSmuME team Copyright (C) 2009-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -85,27 +85,27 @@ Task::Impl::~Impl()
shutdown(); shutdown();
slock_free(mutex); slock_free(mutex);
scond_free(condWork); scond_free(condWork);
} }
void Task::Impl::start(bool spinlock, int threadPriority, const char *name) void Task::Impl::start(bool spinlock, int threadPriority, const char *name)
{ {
slock_lock(this->mutex); slock_lock(this->mutex);
if (this->_isThreadRunning) { if (this->_isThreadRunning) {
slock_unlock(this->mutex); slock_unlock(this->mutex);
return; return;
} }
this->workFunc = NULL; this->workFunc = NULL;
this->workFuncParam = NULL; this->workFuncParam = NULL;
this->ret = NULL; this->ret = NULL;
this->exitThread = false; this->exitThread = false;
this->_thread = sthread_create_with_priority(&taskProc, this, threadPriority); this->_thread = sthread_create_with_priority(&taskProc, this, threadPriority);
this->_isThreadRunning = true; this->_isThreadRunning = true;
if (name) if (name)
sthread_setname(this->_thread, name); sthread_setname(this->_thread, name);
slock_unlock(this->mutex); slock_unlock(this->mutex);
} }
void Task::Impl::execute(const TWork &work, void *param) void Task::Impl::execute(const TWork &work, void *param)
@ -170,7 +170,7 @@ void Task::Impl::shutdown()
slock_unlock(this->mutex); slock_unlock(this->mutex);
} }
void Task::start(bool spinlock) { impl->start(spinlock, 0, nullptr); } void Task::start(bool spinlock) { impl->start(spinlock, 0, NULL); }
void Task::start(bool spinlock, int threadPriority, const char *name) { impl->start(spinlock, threadPriority, name); } void Task::start(bool spinlock, int threadPriority, const char *name) { impl->start(spinlock, threadPriority, name); }
void Task::shutdown() { impl->shutdown(); } void Task::shutdown() { impl->shutdown(); }
Task::Task() : impl(new Task::Impl()) {} Task::Task() : impl(new Task::Impl()) {}

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2018 DeSmuME team Copyright (C) 2009-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -29,8 +29,8 @@ public:
typedef void * (*TWork)(void *); typedef void * (*TWork)(void *);
// initialize task runner // initialize task runner
void start(bool spinlock); void start(bool spinlock);
void start(bool spinlock, int threadPriority, const char *name = nullptr); void start(bool spinlock, int threadPriority, const char *name);
//execute some work //execute some work
void execute(const TWork &work, void* param); void execute(const TWork &work, void* param);

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2007 Tim Seidel Copyright (C) 2007 Tim Seidel
Copyright (C) 2008-2018 DeSmuME team Copyright (C) 2008-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -3396,7 +3396,7 @@ bool AdhocCommInterface::Start(WifiHandler* currentWifiHandler)
this->_rawPacket = (RXRawPacketData*)calloc(1, sizeof(RXRawPacketData)); this->_rawPacket = (RXRawPacketData*)calloc(1, sizeof(RXRawPacketData));
#ifdef DESMUME_COCOA #ifdef DESMUME_COCOA
this->_rxTask->start(false, 43); this->_rxTask->start(false, 43, "wifi ad-hoc");
#else #else
this->_rxTask->start(false, 0, "wifi ad-hoc"); this->_rxTask->start(false, 0, "wifi ad-hoc");
#endif #endif
@ -3670,7 +3670,7 @@ bool SoftAPCommInterface::Start(WifiHandler* currentWifiHandler)
this->_rawPacket = (RXRawPacketData*)calloc(1, sizeof(RXRawPacketData)); this->_rawPacket = (RXRawPacketData*)calloc(1, sizeof(RXRawPacketData));
#ifdef DESMUME_COCOA #ifdef DESMUME_COCOA
this->_rxTask->start(false, 43); this->_rxTask->start(false, 43, "wifi ap");
#else #else
this->_rxTask->start(false, 0, "wifi ap"); this->_rxTask->start(false, 0, "wifi ap");
#endif #endif