git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@61896
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
2011-07-04 Carsten Haitzler (The Rasterman)
* Add eina_mmap safety handling.
+
+2011-07-29 Cedric Bail
+
+ * Add eina_main_loop_is.
+
EAPI int eina_threads_shutdown(void);
/**
+ * @brief Check if you are calling this function from the same thread Eina was initialized or not
+ *
+ * Most EFL function are not thread safe and all the call need to happen in
+ * the main loop. With this call you could know if you can call an EFL
+ * function or not.
+ */
+EAPI Eina_Bool eina_main_loop_is(void);
+
+/**
* @}
*/
#endif
}
+EAPI Eina_Bool
+eina_main_loop_is(void)
+{
+#ifdef EINA_HAVE_DEBUG_THREADS
+ if (pthread_equal(_eina_main_loop, pthread_self()))
+ return EINA_TRUE;
+ return EINA_FALSE;
+#else
+ /* FIXME: need to check how to do this on windows */
+ return EINA_TRUE;
+#endif
+}
+
/**
* @}
*/