Fix EcoreMainloop PostAndWakeUp behavior (#695)
authorSeungkeun Lee <sngn.lee@samsung.com>
Wed, 30 Jan 2019 01:01:30 +0000 (10:01 +0900)
committerarosis78 <35049857+arosis78@users.noreply.github.com>
Wed, 30 Jan 2019 01:01:30 +0000 (10:01 +0900)
- it synchronously called on main loop thread. it should be asynchronously called

src/ElmSharp/ElmSharp/EcoreMainloop.cs

index 00660cbd123ed0f03f195c58d5faf5257823b350..e37ab304b441a558edc4cb699ec78a643b414be0 100644 (file)
@@ -82,8 +82,15 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public static void PostAndWakeUp(Action task)
         {
-            int id = RegistHandler(() => { task(); return false; });
-            Interop.Ecore.ecore_main_loop_thread_safe_call_async(_nativeHandler, (IntPtr)id);
+            if (IsMainThread)
+            {
+                Post(task);
+            }
+            else
+            {
+                int id = RegistHandler(() => { task(); return false; });
+                Interop.Ecore.ecore_main_loop_thread_safe_call_async(_nativeHandler, (IntPtr)id);
+            }
         }
 
         /// <summary>