CtrlCore: New MT rules implemented in X11 and GTK

git-svn-id: svn://ultimatepp.org/upp/trunk@6170 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-07-06 12:32:06 +00:00
parent a5cc4e2902
commit 8f9bfcc8e3
9 changed files with 59 additions and 64 deletions

View file

@ -581,10 +581,10 @@ void WakeUpGuiThread()
g_main_context_wakeup(g_main_context_default());
}
void Ctrl::EventLoop0(Ctrl *ctrl)
void Ctrl::EventLoop(Ctrl *ctrl)
{
GuiLock __;
ASSERT(IsMainThread());
ASSERT_(IsMainThread(), "Event loop can only run in the main thread");
ASSERT(LoopLevel == 0 || ctrl);
LoopLevel++;
LLOG("Entering event loop at level " << LoopLevel << LOG_BEGIN);
@ -614,9 +614,10 @@ gboolean sOnce(GtkWidget *)
return false;
}
void Ctrl::GuiSleep0(int ms)
void Ctrl::GuiSleep(int ms)
{
GuiLock __;
ASSERT_(IsMainThread(), "Only the main thread can perform GuiSleep");
if(ms < 20) // Periodic timer is each 20ms, so that is the longest possible wait
g_timeout_add(ms, (GSourceFunc) sOnce, NULL); // otherwise setup shorter timer
FetchEvents(TRUE);