More Linux fixes
This commit is contained in:
parent
3857025253
commit
6ec2f3e56e
|
|
@ -165,15 +165,14 @@ namespace Nz
|
|||
|
||||
if (m_style & WindowStyle_Threaded)
|
||||
{
|
||||
Mutex mutex;
|
||||
ConditionVariable condition;
|
||||
std::mutex mutex;
|
||||
std::condition_variable condition;
|
||||
m_threadActive = true;
|
||||
|
||||
// Wait until the thread is ready
|
||||
mutex.Lock();
|
||||
m_thread = Thread(WindowThread, this, &mutex, &condition);
|
||||
condition.Wait(&mutex);
|
||||
mutex.Unlock();
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
m_thread = std::string(WindowThread, this, std::ref(mutex), std::ref(condition));
|
||||
condition.wait(lock);
|
||||
}
|
||||
|
||||
// Set fullscreen video mode and switch to fullscreen if necessary
|
||||
|
|
@ -1577,11 +1576,12 @@ namespace Nz
|
|||
));
|
||||
}
|
||||
|
||||
void WindowImpl::WindowThread(WindowImpl* window, Mutex* mutex, ConditionVariable* condition)
|
||||
void WindowImpl::WindowThread(WindowImpl* window, std::mutex& mutex, std::condition_variable& condition)
|
||||
{
|
||||
mutex->Lock();
|
||||
condition->Signal();
|
||||
mutex->Unlock(); // mutex and condition may be destroyed after this line
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
condition.notify_all();
|
||||
}
|
||||
|
||||
if (!window->m_window)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@
|
|||
#define NAZARA_WINDOWIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Platform/Enums.hpp>
|
||||
#include <Nazara/Platform/Keyboard.hpp>
|
||||
#include <Nazara/Platform/WindowHandle.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <xcb/randr.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class ConditionVariable;
|
||||
class Mutex;
|
||||
class Cursor;
|
||||
class Icon;
|
||||
class VideoMode;
|
||||
|
|
@ -100,13 +100,13 @@ namespace Nz
|
|||
bool UpdateNormalHints();
|
||||
void UpdateEventQueue(xcb_generic_event_t* event);
|
||||
|
||||
static void WindowThread(WindowImpl* window, Mutex* mutex, ConditionVariable* condition);
|
||||
static void WindowThread(WindowImpl* window, std::mutex& mutex, std::condition_variable& condition);
|
||||
|
||||
xcb_window_t m_window;
|
||||
xcb_screen_t* m_screen;
|
||||
xcb_randr_get_screen_info_reply_t m_oldVideoMode;
|
||||
xcb_size_hints_t m_size_hints;
|
||||
Thread m_thread;
|
||||
std::thread m_thread;
|
||||
WindowStyleFlags m_style;
|
||||
Window* m_parent;
|
||||
bool m_eventListener;
|
||||
|
|
|
|||
Loading…
Reference in New Issue