2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System.Threading;
23 /// Provides a synchronization context for the efl application.
25 public class EcoreSynchronizationContext : SynchronizationContext
28 /// Initializes a new instance of the EcoreSynchronizationContext class.
30 public EcoreSynchronizationContext()
35 /// Initilizes a new EcoreSynchronizationContext and install into current thread
40 /// SetSynchronizationContext(new EcoreSynchronizationContext());
43 public static void Initialize()
45 SetSynchronizationContext(new EcoreSynchronizationContext());
49 /// Dispatches an asynchronous message to a Ecore main loop.
51 /// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param>
52 /// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param>
53 /// <remarks>The Post method starts an asynchronous request to post a message.</remarks>
54 public override void Post(SendOrPostCallback d, object state)
56 EcoreMainloop.PostAndWakeUp(() =>
63 /// Dispatches a synchronous message to a Ecore main loop
65 /// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param>
66 /// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param>
68 /// The Send method starts a synchronous request to send a message.</remarks>
69 public override void Send(SendOrPostCallback d, object state)
71 EcoreMainloop.Send(() =>