示例#1
0
文件: EoPromises.cs 项目: sav/efl
        public static async Task Consume(efl.ILoop loop)
        {
            Task <eina.Value> task = loop.IdleAsync();

            eina.Value v = await task;
            loop.Quit(v);
        }
示例#2
0
文件: EoPromises.cs 项目: sav/efl
        public static void test_simple_task_run()
        {
            efl.ILoop   loop   = efl.App.GetLoopMain();
            eina.Future future = loop.Idle();

            bool callbackCalled = false;
            int  ret_code       = 1992;

            future.Then((eina.Value value) => {
                callbackCalled = true;
                eina.Value v   = new eina.Value(eina.ValueType.Int32);
                v.Set(ret_code);
                loop.Quit(v);
                return(value);
            });
            eina.Value ret_value = loop.Begin();

            Test.Assert(callbackCalled, "Future loop callback must have been called.");

            Test.AssertEquals(ret_value.GetValueType(), eina.ValueType.Int32);

            int ret_from_value;

            Test.Assert(ret_value.Get(out ret_from_value));
            Test.AssertEquals(ret_from_value, ret_code);
        }