Cleaned up more of the gui core code

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402564
This commit is contained in:
Davis King 2008-10-15 02:13:51 +00:00
parent d1487bb141
commit 9f7abda42f
2 changed files with 13 additions and 8 deletions

View File

@ -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:

View File

@ -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: