git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50757
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) = 0;
#endif
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) = 0;
#endif
+#if wxUSE_THREADS
+ virtual void MutexGuiEnter();
+ virtual void MutexGuiLeave();
+#endif
+
// functions returning port-specific information
// ------------------------------------------------------------------------
// functions returning port-specific information
// ------------------------------------------------------------------------
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
#endif
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
#endif
+#if wxUSE_THREADS && defined(__WXGTK20__)
+ virtual void MutexGuiEnter();
+ virtual void MutexGuiLeave();
+#endif
#if (defined(__WXMAC__) || defined(__WXCOCOA__)) && wxUSE_STDPATHS
virtual wxStandardPathsBase& GetStandardPaths();
#if (defined(__WXMAC__) || defined(__WXCOCOA__)) && wxUSE_STDPATHS
virtual wxStandardPathsBase& GetStandardPaths();
+#if wxUSE_THREADS
+void wxMutexGuiEnterImpl();
+void wxMutexGuiLeaveImpl();
+
+void wxAppTraitsBase::MutexGuiEnter()
+{
+ wxMutexGuiEnterImpl();
+}
+
+void wxAppTraitsBase::MutexGuiLeave()
+{
+ wxMutexGuiLeaveImpl();
+}
+
+void WXDLLIMPEXP_BASE wxMutexGuiEnter()
+{
+ wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiEnter();
+}
+
+void WXDLLIMPEXP_BASE wxMutexGuiLeave()
+{
+ wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiLeave();
+}
+#endif // wxUSE_THREADS
+
#ifdef __WXDEBUG__
bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal)
#ifdef __WXDEBUG__
bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal)
extern "C" {
static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
{
extern "C" {
static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
{
- gdk_threads_enter();
-
- wxMutexGuiLeave();
g_mainThreadLocked = true;
gint res = (*wxgs_poll_func)(ufds, nfds, timeout);
g_mainThreadLocked = true;
gint res = (*wxgs_poll_func)(ufds, nfds, timeout);
g_mainThreadLocked = false;
g_mainThreadLocked = false;
#if wxUSE_THREADS
if (!g_thread_supported())
#if wxUSE_THREADS
if (!g_thread_supported())
+ gdk_threads_init();
+ }
wxgs_poll_func = g_main_context_get_poll_func(NULL);
g_main_context_set_poll_func(NULL, wxapp_poll_func);
wxgs_poll_func = g_main_context_get_poll_func(NULL);
g_main_context_set_poll_func(NULL, wxapp_poll_func);
+
+#if wxUSE_THREADS
+void wxGUIAppTraits::MutexGuiEnter()
+{
+ gdk_threads_enter();
+}
+
+void wxGUIAppTraits::MutexGuiLeave()
+{
+ gdk_threads_leave();
+}
+#endif // wxUSE_THREADS
// GUI Serialization copied from MSW implementation
// ----------------------------------------------------------------------------
// GUI Serialization copied from MSW implementation
// ----------------------------------------------------------------------------
-void WXDLLIMPEXP_BASE wxMutexGuiEnter()
+void wxMutexGuiEnterImpl()
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
gs_critsectGui->Enter();
}
gs_critsectGui->Enter();
}
-void WXDLLIMPEXP_BASE wxMutexGuiLeave()
+void wxMutexGuiLeaveImpl()
{
wxCriticalSectionLocker enter(*gs_critsectWaitingForGui);
{
wxCriticalSectionLocker enter(*gs_critsectWaitingForGui);
// not a mutex, so the names are a bit confusing
// ----------------------------------------------------------------------------
// not a mutex, so the names are a bit confusing
// ----------------------------------------------------------------------------
-void WXDLLIMPEXP_BASE wxMutexGuiEnter()
+void wxMutexGuiEnterImpl()
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
gs_critsectGui->Enter();
}
gs_critsectGui->Enter();
}
-void WXDLLIMPEXP_BASE wxMutexGuiLeave()
+void wxMutexGuiLeaveImpl()
{
wxCriticalSectionLocker enter(*gs_critsectWaitingForGui);
{
wxCriticalSectionLocker enter(*gs_critsectWaitingForGui);
-void WXDLLEXPORT wxMutexGuiEnter()
+void wxMutexGuiEnterImpl()
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
gs_pCritsectGui->Enter();
}
gs_pCritsectGui->Enter();
}
-void WXDLLEXPORT wxMutexGuiLeave()
+void wxMutexGuiLeaveImpl()
{
wxCriticalSectionLocker enter(*gs_pCritsectWaitingForGui);
{
wxCriticalSectionLocker enter(*gs_pCritsectWaitingForGui);
// not a mutex, so the names are a bit confusing
// ----------------------------------------------------------------------------
// not a mutex, so the names are a bit confusing
// ----------------------------------------------------------------------------
-void WXDLLIMPEXP_BASE wxMutexGuiEnter()
+void wxMutexGuiEnterImpl()
-void WXDLLIMPEXP_BASE wxMutexGuiLeave()
+void wxMutexGuiLeaveImpl()
+void wxMutexGuiEnterImpl()
+void wxMutexGuiLeaveImpl()
{
gs_mutexGui->Unlock();
}
{
gs_mutexGui->Unlock();
}