Skip to content

Commit f75fcb9

Browse files
committed
Use a lambra for display update function
1 parent 075082a commit f75fcb9

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/player.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -774,19 +774,6 @@ bool ConsolePlayer::createSidEmu (SIDEMUS emu, const SidTuneInfo *tuneInfo)
774774
return false;
775775
}
776776

777-
void ConsolePlayer::displayThread()
778-
{
779-
using namespace std::chrono_literals;
780-
781-
while (m_state == playerRunning)
782-
{
783-
updateDisplay();
784-
// TODO 16ms for NTSC?
785-
std::this_thread::sleep_for(20ms);
786-
}
787-
}
788-
789-
790777
bool ConsolePlayer::open (void)
791778
{
792779
if ((m_state & ~playerFast) == playerRestart)
@@ -896,7 +883,17 @@ bool ConsolePlayer::open (void)
896883

897884
// Update display
898885
menu();
899-
m_thread = new std::thread(&ConsolePlayer::displayThread, this);
886+
m_thread = new std::thread([this]()
887+
{
888+
using namespace std::chrono_literals;
889+
890+
while (m_state == playerRunning)
891+
{
892+
updateDisplay();
893+
// TODO 16ms for NTSC?
894+
std::this_thread::sleep_for(20ms);
895+
}
896+
});
900897

901898
return true;
902899
}

src/player.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,6 @@ class ConsolePlayer
264264
inline bool tryOpenTune(const char *hvscBase);
265265
inline bool tryOpenDatabase(const char *hvscBase, const char *suffix);
266266

267-
void displayThread();
268-
269267
public:
270268
ConsolePlayer (const char * const name);
271269
virtual ~ConsolePlayer() = default;

0 commit comments

Comments
 (0)