Commit 9f7abda4 authored by Davis King's avatar Davis King

Cleaned up more of the gui core code

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402564
parent d1487bb1
......@@ -63,9 +63,9 @@ namespace dlib
// ----------------------------------------------------------------------------------------
dlib::mutex* global_mutex()
const shared_ptr_thread_safe<dlib::mutex>& global_mutex()
{
static dlib::mutex* m = new dlib::mutex;
static shared_ptr_thread_safe<dlib::mutex> m(new dlib::mutex);
return m;
}
......@@ -118,6 +118,8 @@ namespace dlib
// processing.
thread_id_type event_thread_id;
shared_ptr_thread_safe<dlib::mutex> reference_to_global_mutex;
event_handler_thread(
) :
dlog("dlib.gui_core"),
......@@ -138,7 +140,8 @@ namespace dlib
in_ime_composition(false),
event_thread_started(false),
window_close_signaler(window_table.get_mutex()),
et_signaler(window_table.get_mutex())
et_signaler(window_table.get_mutex()),
reference_to_global_mutex(global_mutex())
{
status = uninitialized;
}
......@@ -185,7 +188,6 @@ namespace dlib
wait();
}
delete global_mutex();
}
private:
......
......@@ -48,9 +48,9 @@ namespace dlib
// ----------------------------------------------------------------------------------------
dlib::mutex* global_mutex()
const shared_ptr_thread_safe<dlib::mutex>& global_mutex()
{
static dlib::mutex* m = new dlib::mutex;
static shared_ptr_thread_safe<dlib::mutex> m(new dlib::mutex);
return m;
}
......@@ -94,6 +94,8 @@ namespace dlib
queue_of_user_events user_events;
queue_of_user_events user_events_temp;
shared_ptr_thread_safe<dlib::mutex> reference_to_global_mutex;
event_handler_thread(
) :
dlog("dlib.gui_core"),
......@@ -106,7 +108,8 @@ namespace dlib
num_lock_mask(0),
scroll_lock_mask(0),
window_close_signaler(window_table.get_mutex()),
et_signaler(window_table.get_mutex())
et_signaler(window_table.get_mutex()),
reference_to_global_mutex(global_mutex())
{
auto_mutex M(window_table.get_mutex());
......@@ -166,7 +169,7 @@ namespace dlib
}
}
delete global_mutex();
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment