From: Seungkeun Lee Date: Tue, 19 Apr 2016 05:12:12 +0000 (+0900) Subject: Change to public about TizenSynchronizationContext X-Git-Tag: submit/trunk/20170823.075128~121^2~176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6dcbd3a25d44cc05578f1822bbcbae49552353f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Change to public about TizenSynchronizationContext - The application developer could use this class to post task into tizen main loop - Others SynchronizationContext are also public classes Change-Id: Id3e4781c9d7059be22b21f6327d6674f6c75009f --- diff --git a/Tizen.Applications/Tizen.Applications/TizenSynchronizationContext.cs b/Tizen.Applications/Tizen.Applications/TizenSynchronizationContext.cs old mode 100755 new mode 100644 index 6f7d0bc..ca70228 --- a/Tizen.Applications/Tizen.Applications/TizenSynchronizationContext.cs +++ b/Tizen.Applications/Tizen.Applications/TizenSynchronizationContext.cs @@ -13,23 +13,47 @@ using System.Threading; namespace Tizen.Applications { - internal class TizenSynchronizationContext : SynchronizationContext + + /// + /// Provides a synchronization context for the Tizen application model. + /// + public class TizenSynchronizationContext : SynchronizationContext { private readonly Interop.Glib.GSourceFunc _wrapperHandler; private readonly Object _transactionLock = new Object(); private readonly Dictionary _handlerMap = new Dictionary(); private int _transactionId = 0; - private TizenSynchronizationContext() + /// + /// Initializes a new instance of the TizenSynchronizationContext class. + /// + public TizenSynchronizationContext() { _wrapperHandler = new Interop.Glib.GSourceFunc(Handler); } + /// + /// Initilizes a new TizenSynchronizationContext and install into current thread + /// + /// + /// It is equivalent + /// + /// SetSynchronizationContext(new TizenSynchronizationContext()); + /// + /// public static void Initialize() { SetSynchronizationContext(new TizenSynchronizationContext()); } + + /// + /// Dispatches an asynchronous message to a Tizen main loop. + /// + /// The SendOrPostCallback delegate to call. + /// The object passed to the delegate. + /// + /// The Post method starts an asynchronous request to post a message. public override void Post(SendOrPostCallback d, object state) { Post(() => @@ -38,6 +62,13 @@ namespace Tizen.Applications }); } + /// + /// Dispatches a synchronous message to a Tizen main loop + /// + /// The SendOrPostCallback delegate to call. + /// The object passed to the delegate. + /// + /// The Send method starts a synchronous request to send a message. public override void Send(SendOrPostCallback d, object state) { var mre = new ManualResetEvent(false); @@ -64,7 +95,7 @@ namespace Tizen.Applications } } - public void Post(Action action) + private void Post(Action action) { int id = 0; lock (_transactionLock) @@ -75,7 +106,7 @@ namespace Tizen.Applications Interop.Glib.IdleAdd(_wrapperHandler, (IntPtr)id); } - public bool Handler(IntPtr userData) + private bool Handler(IntPtr userData) { int key = (int)userData; if (_handlerMap.ContainsKey(key))