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 00660cb..e37ab30 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>