+EAPI Eina_Bool
+eina_main_loop_is(void)
+{
+#ifdef EFL_HAVE_THREADS
+ pid_t pid;
+
+# ifdef _WIN32
+ if (_eina_main_loop == GetCurrentThreadId())
+ return EINA_TRUE;
+# else
+ if (pthread_equal(_eina_main_loop, pthread_self()))
+ return EINA_TRUE;
+# endif
+
+ pid = getpid();
+# ifdef _WIN32
+ if (pid != _eina_pid)
+ {
+ _eina_pid = pid;
+ _eina_main_loop = GetCurrentThreadId();
+ return EINA_TRUE;
+ }
+#else
+ if (pid != _eina_pid)
+ {
+ /* This is in case of a fork, but don't like the solution */
+ _eina_pid = pid;
+ _eina_main_loop = pthread_self();
+ return EINA_TRUE;
+ }
+#endif
+#endif
+
+ return EINA_FALSE;
+}
+
+/** The purpose of this API should not be documented, it is used only by the one who know what they are doing. */
+EAPI void
+eina_main_loop_define(void)
+{
+#ifdef EFL_HAVE_THREADS
+ _eina_pid = getpid();
+# ifdef _WIN32
+ _eina_main_loop = GetCurrentThreadId();
+# else
+ _eina_main_loop = pthread_self();
+# endif
+#endif
+}
+