Add MinGW std threads include to music/win32_m.cpp
Fix uses of std::lock_guard
This commit is contained in:
@@ -20,6 +20,10 @@
|
|||||||
#include "midi.h"
|
#include "midi.h"
|
||||||
#include "../base_media_base.h"
|
#include "../base_media_base.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
#include "../3rdparty/mingw-std-threads/mingw.mutex.h"
|
||||||
|
#include "../3rdparty/mingw-std-threads/mingw.condition_variable.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
@@ -328,7 +332,7 @@ void MusicDriver_Win32::PlaySong(const MusicSongInfo &song)
|
|||||||
if (!new_song.LoadSong(song)) return;
|
if (!new_song.LoadSong(song)) return;
|
||||||
DEBUG(driver, 2, "Win32-MIDI: PlaySong: Loaded song");
|
DEBUG(driver, 2, "Win32-MIDI: PlaySong: Loaded song");
|
||||||
|
|
||||||
std::lock_guard mutex_lock(_midi.lock);
|
std::lock_guard<std::mutex> mutex_lock(_midi.lock);
|
||||||
|
|
||||||
_midi.next_file.MoveFrom(new_song);
|
_midi.next_file.MoveFrom(new_song);
|
||||||
_midi.next_segment.start = song.override_start;
|
_midi.next_segment.start = song.override_start;
|
||||||
@@ -348,7 +352,7 @@ void MusicDriver_Win32::PlaySong(const MusicSongInfo &song)
|
|||||||
void MusicDriver_Win32::StopSong()
|
void MusicDriver_Win32::StopSong()
|
||||||
{
|
{
|
||||||
DEBUG(driver, 2, "Win32-MIDI: StopSong: entry");
|
DEBUG(driver, 2, "Win32-MIDI: StopSong: entry");
|
||||||
std::lock_guard mutex_lock(_midi.lock);
|
std::lock_guard<std::mutex> mutex_lock(_midi.lock);
|
||||||
DEBUG(driver, 2, "Win32-MIDI: StopSong: setting flag");
|
DEBUG(driver, 2, "Win32-MIDI: StopSong: setting flag");
|
||||||
_midi.do_stop = true;
|
_midi.do_stop = true;
|
||||||
}
|
}
|
||||||
@@ -360,7 +364,7 @@ bool MusicDriver_Win32::IsSongPlaying()
|
|||||||
|
|
||||||
void MusicDriver_Win32::SetVolume(byte vol)
|
void MusicDriver_Win32::SetVolume(byte vol)
|
||||||
{
|
{
|
||||||
std::lock_guard mutex_lock(_midi.lock);
|
std::lock_guard<std::mutex> mutex_lock(_midi.lock);
|
||||||
_midi.new_volume = vol;
|
_midi.new_volume = vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +406,7 @@ const char *MusicDriver_Win32::Start(const char * const *parm)
|
|||||||
|
|
||||||
void MusicDriver_Win32::Stop()
|
void MusicDriver_Win32::Stop()
|
||||||
{
|
{
|
||||||
std::lock_guard mutex_lock(_midi.lock);
|
std::lock_guard<std::mutex> mutex_lock(_midi.lock);
|
||||||
|
|
||||||
if (_midi.timer_id) {
|
if (_midi.timer_id) {
|
||||||
timeKillEvent(_midi.timer_id);
|
timeKillEvent(_midi.timer_id);
|
||||||
|
Reference in New Issue
Block a user