- The application developer could use this class to post task into tizen main loop
- Others SynchronizationContext are also public classes
Change-Id: Id3e4781c9d7059be22b21f6327d6674f6c75009f
namespace Tizen.Applications
{
namespace Tizen.Applications
{
- internal class TizenSynchronizationContext : SynchronizationContext
+
+ /// <summary>
+ /// Provides a synchronization context for the Tizen application model.
+ /// </summary>
+ public class TizenSynchronizationContext : SynchronizationContext
{
private readonly Interop.Glib.GSourceFunc _wrapperHandler;
private readonly Object _transactionLock = new Object();
private readonly Dictionary<int, Action> _handlerMap = new Dictionary<int, Action>();
private int _transactionId = 0;
{
private readonly Interop.Glib.GSourceFunc _wrapperHandler;
private readonly Object _transactionLock = new Object();
private readonly Dictionary<int, Action> _handlerMap = new Dictionary<int, Action>();
private int _transactionId = 0;
- private TizenSynchronizationContext()
+ /// <summary>
+ /// Initializes a new instance of the TizenSynchronizationContext class.
+ /// </summary>
+ public TizenSynchronizationContext()
{
_wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
}
{
_wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
}
+ /// <summary>
+ /// Initilizes a new TizenSynchronizationContext and install into current thread
+ /// </summary>
+ /// <remarks>
+ /// It is equivalent
+ /// <code>
+ /// SetSynchronizationContext(new TizenSynchronizationContext());
+ /// </code>
+ /// </remarks>
public static void Initialize()
{
SetSynchronizationContext(new TizenSynchronizationContext());
}
public static void Initialize()
{
SetSynchronizationContext(new TizenSynchronizationContext());
}
+
+ /// <summary>
+ /// Dispatches an asynchronous message to a Tizen main loop.
+ /// </summary>
+ /// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param>
+ /// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param>
+ /// <remarks>
+ /// The Post method starts an asynchronous request to post a message.</remarks>
public override void Post(SendOrPostCallback d, object state)
{
Post(() =>
public override void Post(SendOrPostCallback d, object state)
{
Post(() =>
+ /// <summary>
+ /// Dispatches a synchronous message to a Tizen main loop
+ /// </summary>
+ /// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param>
+ /// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param>
+ /// <remarks>
+ /// The Send method starts a synchronous request to send a message.</remarks>
public override void Send(SendOrPostCallback d, object state)
{
var mre = new ManualResetEvent(false);
public override void Send(SendOrPostCallback d, object state)
{
var mre = new ManualResetEvent(false);
- public void Post(Action action)
+ private void Post(Action action)
{
int id = 0;
lock (_transactionLock)
{
int id = 0;
lock (_transactionLock)
Interop.Glib.IdleAdd(_wrapperHandler, (IntPtr)id);
}
Interop.Glib.IdleAdd(_wrapperHandler, (IntPtr)id);
}
- public bool Handler(IntPtr userData)
+ private bool Handler(IntPtr userData)
{
int key = (int)userData;
if (_handlerMap.ContainsKey(key))
{
int key = (int)userData;
if (_handlerMap.ContainsKey(key))