if using ecore_main_loop_begin() multiple times (reentrant/recursive)
with glib doing threads, then it would deadlock since the same thread
would get the lock it already have.
multiple ecore_main_loop_begin() is required to implement WebKit's
alert/confirm/prompt dialogs since there is no async reply with
callbacks, rather one must return the value.
By: Lucas de Marchi
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@46361
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
static int
_ecore_glib_select(int ecore_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *ecore_timeout)
{
- static GStaticMutex lock = G_STATIC_MUTEX_INIT;
- static GMutex *mutex = NULL;
+ GStaticMutex lock = G_STATIC_MUTEX_INIT;
+ GMutex *mutex = g_static_mutex_get_mutex(&lock);
GMainContext *ctx = g_main_context_default();
int ret;
- if (!mutex)
- mutex = g_static_mutex_get_mutex(&lock);
-
if (g_main_context_acquire(ctx))
g_mutex_lock(mutex);
else {