Skip to content

Commit

Permalink
Traktor: Updated more C++20 lambdas.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Jun 13, 2024
1 parent b2465ba commit 02c6145
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion code/Core/System/Win32/ProcessWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PipeStream : public IStream
, m_hPipe(hPipe)
{
ThreadPool::getInstance().spawn(
[this]() { threadPipeReader(); },
[=, this]() { threadPipeReader(); },
m_thread
);
}
Expand Down
2 changes: 1 addition & 1 deletion code/Core/Thread/JobQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool JobQueue::create(uint32_t workerThreads, Thread::Priority priority)
for (uint32_t i = 0; i < uint32_t(m_workerThreads.size()); ++i)
{
m_workerThreads[i] = ThreadManager::getInstance().create(
[this]() { threadWorker(); },
[=, this]() { threadWorker(); },
L"Job queue, worker thread"
);
if (m_workerThreads[i])
Expand Down
2 changes: 1 addition & 1 deletion code/Database/Remote/Server/ConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool ConnectionManager::create()
m_listenPort = dynamic_type_cast< net::SocketAddressIPv4* >(m_listenSocket->getLocalAddress())->getPort();

m_serverThread = ThreadManager::getInstance().create(
[this](){ threadServer(); },
[=, this](){ threadServer(); },
L"Database server"
);
if (!m_serverThread)
Expand Down
2 changes: 1 addition & 1 deletion code/Editor/App/BrowseInstanceDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ bool BrowseInstanceDialog::create(ui::Widget* parent, db::Database* database, co

// Spawn preview generator thread.
ThreadPool::getInstance().spawn(
[this](){ threadGeneratePreview(); },
[=, this](){ threadGeneratePreview(); },
m_threadGeneratePreview
);

Expand Down
26 changes: 13 additions & 13 deletions code/Editor/App/EditorForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,8 @@ Ref< db::Instance > EditorForm::browseInstance(const IBrowseFilter* filter)
bool EditorForm::openEditor(db::Instance* instance)
{
T_ANONYMOUS_VAR(EnterLeave)(
[this](){ setCursor(ui::Cursor::Wait); },
[this](){ resetCursor(); }
[=, this](){ setCursor(ui::Cursor::Wait); },
[=, this](){ resetCursor(); }
);

T_ASSERT(instance);
Expand Down Expand Up @@ -1201,8 +1201,8 @@ bool EditorForm::openEditor(db::Instance* instance)
bool EditorForm::openDefaultEditor(db::Instance* instance)
{
T_ANONYMOUS_VAR(EnterLeave)(
[this](){ setCursor(ui::Cursor::Wait); },
[this](){ resetCursor(); }
[=, this](){ setCursor(ui::Cursor::Wait); },
[=, this](){ resetCursor(); }
);

T_ASSERT(instance);
Expand Down Expand Up @@ -1241,8 +1241,8 @@ bool EditorForm::openDefaultEditor(db::Instance* instance)
bool EditorForm::openInNewEditor(db::Instance* instance)
{
T_ANONYMOUS_VAR(EnterLeave)(
[this]() { setCursor(ui::Cursor::Wait); },
[this]() { resetCursor(); }
[=, this]() { setCursor(ui::Cursor::Wait); },
[=, this]() { resetCursor(); }
);

T_ASSERT(instance);
Expand Down Expand Up @@ -1538,7 +1538,7 @@ bool EditorForm::openWorkspace(const Path& workspacePath)
updateTitle();

// Create asset monitor thread.
m_threadAssetMonitor = ThreadManager::getInstance().create([this](){ threadAssetMonitor(); }, L"Asset monitor");
m_threadAssetMonitor = ThreadManager::getInstance().create([=, this](){ threadAssetMonitor(); }, L"Asset monitor");
m_threadAssetMonitor->start();

log::info << L"Workspace opened successfully." << Endl;
Expand Down Expand Up @@ -1860,8 +1860,8 @@ void EditorForm::buildAsset(const Guid& assetGuid, bool rebuild)
void EditorForm::buildAssets(bool rebuild)
{
T_ANONYMOUS_VAR(EnterLeave)(
[this](){ setCursor(ui::Cursor::Wait); },
[this](){ resetCursor(); }
[=, this](){ setCursor(ui::Cursor::Wait); },
[=, this](){ resetCursor(); }
);

if (!m_workspaceSettings)
Expand Down Expand Up @@ -2110,8 +2110,8 @@ void EditorForm::moveNewTabGroup()
void EditorForm::saveCurrentDocument()
{
T_ANONYMOUS_VAR(EnterLeave)(
[this](){ setCursor(ui::Cursor::Wait); },
[this](){ resetCursor(); }
[=, this](){ setCursor(ui::Cursor::Wait); },
[=, this](){ resetCursor(); }
);

// First iterate all object editor dialogs to see if focus is in any of those,
Expand Down Expand Up @@ -2225,8 +2225,8 @@ void EditorForm::saveAsCurrentDocument()
void EditorForm::saveAllDocuments()
{
T_ANONYMOUS_VAR(EnterLeave)(
[this](){ setCursor(ui::Cursor::Wait); },
[this](){ resetCursor(); }
[=, this](){ setCursor(ui::Cursor::Wait); },
[=, this](){ resetCursor(); }
);

bool allSuccessfull = true;
Expand Down
2 changes: 1 addition & 1 deletion code/Editor/Pipeline/Avalanche/AvalanchePipelineCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void AvalanchePipelineCache::getInformation(OutputStream& os)

if (m_statsJob == nullptr)
{
m_statsJob = JobManager::getInstance().add([this](){
m_statsJob = JobManager::getInstance().add([=, this](){
m_client->stats(m_stats);
});
}
Expand Down
2 changes: 1 addition & 1 deletion code/Jungle/OnlinePeer2PeerProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ OnlinePeer2PeerProvider::OnlinePeer2PeerProvider(online::ISessionManager* sessio
// Create transmission thread.
if (asyncTx || asyncRx)
{
if (!ThreadPool::getInstance().spawn([this](){ transmissionThread(); }, m_thread))
if (!ThreadPool::getInstance().spawn([=, this](){ transmissionThread(); }, m_thread))
{
m_thread = nullptr;
m_asyncTx =
Expand Down
2 changes: 1 addition & 1 deletion code/Net/Discovery/DiscoveryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool DiscoveryManager::create(uint32_t mode)
log::info << L"Discovery manager: receive address " << m_replyToAddress << L"." << Endl;

// Create communication thread.
m_threadMulticastListener = ThreadManager::getInstance().create([this](){ threadMulticastListener(); }, L"Discovery listener");
m_threadMulticastListener = ThreadManager::getInstance().create([=, this](){ threadMulticastListener(); }, L"Discovery listener");
if (!m_threadMulticastListener)
{
log::error << L"Discovery setup failed; unable to create listener thread." << Endl;
Expand Down
2 changes: 1 addition & 1 deletion code/Net/Stream/StreamServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool StreamServer::create()

m_listenPort = dynamic_type_cast< net::SocketAddressIPv4* >(m_listenSocket->getLocalAddress())->getPort();

m_serverThread = ThreadManager::getInstance().create([this](){ threadServer(); }, L"Stream server");
m_serverThread = ThreadManager::getInstance().create([=, this](){ threadServer(); }, L"Stream server");
if (!m_serverThread)
return false;

Expand Down
2 changes: 1 addition & 1 deletion code/Online/Impl/TaskQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ T_IMPLEMENT_RTTI_CLASS(L"traktor.online.TaskQueue", TaskQueue, Object)

bool TaskQueue::create()
{
m_thread = ThreadManager::getInstance().create([this](){ threadQueue(); }, L"Online task queue");
m_thread = ThreadManager::getInstance().create([=, this](){ threadQueue(); }, L"Online task queue");
if (!m_thread || !m_thread->start())
return false;

Expand Down
2 changes: 1 addition & 1 deletion code/Remote/Server/Editor/RemoteEditorPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool RemoteEditorPlugin::create(editor::IEditor* editor, ui::Widget* parent, edi
return false;
}

m_threadServer = ThreadManager::getInstance().create([this](){ threadServer(); }, L"Remote server");
m_threadServer = ThreadManager::getInstance().create([=, this](){ threadServer(); }, L"Remote server");
m_threadServer->start();
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions code/Render/Editor/Shader/Facades/CommentNodeFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void CommentNodeFacade::editShaderNode(
m_edit = new ui::Edit();
m_edit->create(graphControl);
m_edit->addEventHandler< ui::FocusEvent >(
[this](ui::FocusEvent* event)
[=, this](ui::FocusEvent* event)
{
if (m_edit->isVisible(false) && event->lostFocus())
{
Expand All @@ -85,7 +85,7 @@ void CommentNodeFacade::editShaderNode(
}
);
m_edit->addEventHandler< ui::KeyDownEvent >(
[this](ui::KeyDownEvent* event)
[=, this](ui::KeyDownEvent* event)
{
if (event->getVirtualKey() == ui::VkReturn)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Render/Editor/Shader/Facades/ScalarNodeFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void ScalarNodeFacade::editShaderNode(
m_edit = new ui::Edit();
m_edit->create(graphControl, L"", ui::WsNone, new ui::NumericEditValidator(true));
m_edit->addEventHandler< ui::FocusEvent >(
[this](ui::FocusEvent* event)
[=, this](ui::FocusEvent* event)
{
if (m_edit->isVisible(false) && event->lostFocus())
{
Expand All @@ -101,7 +101,7 @@ void ScalarNodeFacade::editShaderNode(
}
);
m_edit->addEventHandler< ui::KeyDownEvent >(
[this](ui::KeyDownEvent* event)
[=, this](ui::KeyDownEvent* event)
{
if (event->getVirtualKey() == ui::VkReturn)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Render/Editor/Shader/Facades/SwizzleNodeFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void SwizzleNodeFacade::editShaderNode(
m_edit = new ui::Edit();
m_edit->create(graphControl);
m_edit->addEventHandler< ui::FocusEvent >(
[this](ui::FocusEvent* event)
[=, this](ui::FocusEvent* event)
{
if (m_edit->isVisible(false) && event->lostFocus())
{
Expand All @@ -109,7 +109,7 @@ void SwizzleNodeFacade::editShaderNode(
}
);
m_edit->addEventHandler< ui::KeyDownEvent >(
[this](ui::KeyDownEvent* event)
[=, this](ui::KeyDownEvent* event)
{
if (event->getVirtualKey() == ui::VkReturn)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Render/Editor/Shader/Facades/UniformNodeFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void UniformNodeFacade::editShaderNode(
m_edit = new ui::Edit();
m_edit->create(graphControl);
m_edit->addEventHandler< ui::FocusEvent >(
[this](ui::FocusEvent* event)
[=, this](ui::FocusEvent* event)
{
if (m_edit->isVisible(false) && event->lostFocus())
{
Expand All @@ -109,7 +109,7 @@ void UniformNodeFacade::editShaderNode(
}
);
m_edit->addEventHandler< ui::KeyDownEvent >(
[this](ui::KeyDownEvent* event)
[=, this](ui::KeyDownEvent* event)
{
if (event->getVirtualKey() == ui::VkReturn)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Render/Editor/Shader/Facades/VariableNodeFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void VariableNodeFacade::editShaderNode(
m_edit = new ui::Edit();
m_edit->create(graphControl);
m_edit->addEventHandler< ui::FocusEvent >(
[this](ui::FocusEvent* event)
[=, this](ui::FocusEvent* event)
{
if (m_edit->isVisible(false) && event->lostFocus())
{
Expand All @@ -111,7 +111,7 @@ void VariableNodeFacade::editShaderNode(
}
);
m_edit->addEventHandler< ui::KeyDownEvent >(
[this](ui::KeyDownEvent* event)
[=, this](ui::KeyDownEvent* event)
{
if (event->getVirtualKey() == ui::VkReturn)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Runtime/Editor/EditorPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ bool EditorPlugin::create(editor::IEditor* editor, ui::Widget* parent, editor::I
m_site->createAdditionalPanel(m_splitter, 200_ut, false);

// Create threads.
m_threadHostEnumerator = ThreadManager::getInstance().create([this](){ threadHostEnumerator(); }, L"Host enumerator");
m_threadHostEnumerator = ThreadManager::getInstance().create([=, this](){ threadHostEnumerator(); }, L"Host enumerator");
m_threadHostEnumerator->start();

m_threadTargetActions = ThreadManager::getInstance().create([this](){ threadTargetActions(); }, L"Targets");
m_threadTargetActions = ThreadManager::getInstance().create([=, this](){ threadTargetActions(); }, L"Targets");
m_threadTargetActions->start();

return true;
Expand Down
4 changes: 2 additions & 2 deletions code/Runtime/Impl/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ bool Application::create(
if (settings->getProperty< bool >(L"Runtime.DatabaseThread", false))
{
T_DEBUG(L"Creating database monitoring thread...");
m_threadDatabase = ThreadManager::getInstance().create([this](){ threadDatabase(); }, L"Database events");
m_threadDatabase = ThreadManager::getInstance().create([=, this](){ threadDatabase(); }, L"Database events");
if (m_threadDatabase)
m_threadDatabase->start(Thread::Highest);
}
Expand Down Expand Up @@ -363,7 +363,7 @@ bool Application::create(
settings->getProperty< bool >(L"Runtime.RenderThread", true)
)
{
m_threadRender = ThreadManager::getInstance().create([this](){ threadRender(); }, L"Render");
m_threadRender = ThreadManager::getInstance().create([=, this](){ threadRender(); }, L"Render");
if (m_threadRender)
{
#if defined(__IOS__)
Expand Down
2 changes: 1 addition & 1 deletion code/Runtime/Impl/ScriptServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool ScriptServer::create(
{
m_transport = transport;

m_scriptDebuggerThread = ThreadManager::getInstance().create([this](){ threadDebugger(); }, L"Script debugger/profiler thread");
m_scriptDebuggerThread = ThreadManager::getInstance().create([=, this](){ threadDebugger(); }, L"Script debugger/profiler thread");
if (!m_scriptDebuggerThread)
return false;

Expand Down
2 changes: 1 addition & 1 deletion code/Shape/Editor/Bake/TracerProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ TracerProcessor::TracerProcessor(const TypeInfo* rayTracerType, const std::wstri
{
T_FATAL_ASSERT(m_rayTracerType != nullptr);

m_thread = ThreadManager::getInstance().create([this](){ processorThread(); }, L"Tracer");
m_thread = ThreadManager::getInstance().create([=, this](){ processorThread(); }, L"Tracer");
m_thread->start();

//if (!m_editor)
Expand Down
4 changes: 2 additions & 2 deletions code/Sound/AudioSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bool AudioSystem::create(const AudioSystemCreateDesc& desc)
m_samplesBlocks.push_back(&m_samplesData[i * samplesPerBlock]);

// Create mixer and submission threads.
m_threadMixer = ThreadManager::getInstance().create([this](){ threadMixer(); }, L"Sound mixer", 1);
m_threadMixer = ThreadManager::getInstance().create([=, this](){ threadMixer(); }, L"Sound mixer", 1);
if (!m_threadMixer)
{
m_driver->destroy();
Expand Down Expand Up @@ -209,7 +209,7 @@ void AudioSystem::resume()
// Create threads.
if (!m_threadMixer)
{
m_threadMixer = ThreadManager::getInstance().create([this](){ threadMixer(); }, L"Sound mixer", 1);
m_threadMixer = ThreadManager::getInstance().create([=, this](){ threadMixer(); }, L"Sound mixer", 1);
if (!m_threadMixer)
return;
}
Expand Down
2 changes: 1 addition & 1 deletion code/Spray/EmitterInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ void EmitterInstance::updateTask(float deltaTime)
m_skip < 4
)
{
std::sort(m_renderPoints.begin(), m_renderPoints.end(), [this](const Point& lh, const Point& rh) {
std::sort(m_renderPoints.begin(), m_renderPoints.end(), [=, this](const Point& lh, const Point& rh) {
return (bool)(m_sortPlane.distance(lh.position) > m_sortPlane.distance(rh.position));
});
}
Expand Down
2 changes: 1 addition & 1 deletion code/Video/VideoTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool VideoTexture::create(render::IRenderSystem* renderSystem, IVideoDecoder* de

m_timer.reset();

if (!ThreadPool::getInstance().spawn([this](){ decodeThread(); }, m_thread))
if (!ThreadPool::getInstance().spawn([=, this](){ decodeThread(); }, m_thread))
return false;

return true;
Expand Down

0 comments on commit 02c6145

Please sign in to comment.