- events tested and implemented multithreading support through mpscq
This commit is contained in:
@@ -70,6 +70,7 @@ void window_manager::shutdown() {
|
||||
}
|
||||
|
||||
assertf(_thread == thread::current(), "Attempted to shutdown Window Manager on a different thread!");
|
||||
lock_guard guard(_lock);
|
||||
|
||||
// Cleanup Windows
|
||||
for (auto& window : _windows) {
|
||||
@@ -84,31 +85,47 @@ void window_manager::shutdown() {
|
||||
}
|
||||
|
||||
void window_manager::dispatch() {
|
||||
assertf(_thread == thread::current(), "Attempted to dispatch Window Manager on a different thread!");
|
||||
if (not _display) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertf(_thread == thread::current(), "Attempted to dispatch Window Manager on a different thread!");
|
||||
lock_guard guard(_lock);
|
||||
|
||||
_display->dispatch();
|
||||
}
|
||||
|
||||
window_manager::window_id window_manager::create_window(const window::config& config, window_id parent) {
|
||||
assertf(_thread == thread::current(), "Attempted to create a window on a different thread!");
|
||||
if (not _display) {
|
||||
return nullid;
|
||||
}
|
||||
|
||||
assertf(_thread == thread::current(), "Attempted to create a window on a different thread!");
|
||||
lock_guard guard(_lock);
|
||||
|
||||
window* p = parent == nullid ? nullptr : _windows[parent].get();
|
||||
return _windows.emplace(_display->create_window(config, p));
|
||||
}
|
||||
|
||||
void window_manager::begin(window_id window) {
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
if (not _display) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
lock_guard guard(_lock);
|
||||
|
||||
_windows[window]->begin_frame();
|
||||
}
|
||||
|
||||
void window_manager::end(window_id window) {
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
if (not _display) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
lock_guard guard(_lock);
|
||||
|
||||
_windows[window]->end_frame();
|
||||
}
|
||||
} // fennec
|
||||
Reference in New Issue
Block a user