Win32 UI loop: allow recursion
This commit is contained in:
parent
222a9721aa
commit
d5010fb947
|
@ -57,7 +57,7 @@ void Win32Loop::ThreadMain() {
|
|||
DispatchMessage(&msg);
|
||||
|
||||
// Process queued functions.
|
||||
std::lock_guard<std::mutex> lock(posted_functions_mutex_);
|
||||
std::lock_guard<std::recursive_mutex> lock(posted_functions_mutex_);
|
||||
for (auto it = posted_functions_.begin(); it != posted_functions_.end();) {
|
||||
(*it).Call();
|
||||
it = posted_functions_.erase(it);
|
||||
|
@ -75,7 +75,7 @@ bool Win32Loop::is_on_loop_thread() {
|
|||
void Win32Loop::Post(std::function<void()> fn) {
|
||||
assert_true(thread_id_ != 0);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(posted_functions_mutex_);
|
||||
std::lock_guard<std::recursive_mutex> lock(posted_functions_mutex_);
|
||||
PostedFn posted_fn(fn);
|
||||
posted_functions_.push_back(posted_fn);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class Win32Loop : public Loop {
|
|||
std::mutex pending_timers_mutex_;
|
||||
std::list<PendingTimer*> pending_timers_;
|
||||
|
||||
std::mutex posted_functions_mutex_;
|
||||
std::recursive_mutex posted_functions_mutex_;
|
||||
std::list<PostedFn> posted_functions_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue