当前位置: 首页>>代码示例>>C#>>正文


C# SynchronizationContext.GetType方法代码示例

本文整理汇总了C#中System.Threading.SynchronizationContext.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# SynchronizationContext.GetType方法的具体用法?C# SynchronizationContext.GetType怎么用?C# SynchronizationContext.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Threading.SynchronizationContext的用法示例。


在下文中一共展示了SynchronizationContext.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WaveOutEvent

        /// <summary>
        /// Opens a WaveOut device
        /// </summary>
        public WaveOutEvent()
        {
            syncContext = SynchronizationContext.Current;
            if (syncContext != null &&
                ((syncContext.GetType().Name == "LegacyAspNetSynchronizationContext") ||
                (syncContext.GetType().Name == "AspNetSynchronizationContext")))
            {
                syncContext = null;
            }

            // set default values up
            DeviceNumber = 0;
            DesiredLatency = 300;
            NumberOfBuffers = 2;

            this.waveOutLock = new object();
        }
开发者ID:EnergonV,项目名称:BestCS,代码行数:20,代码来源:WaveOutEvent.cs

示例2: InitializeApartmentDetails

		private void InitializeApartmentDetails ()
		{
			// Only synchronization_context if thread is STA.
			if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
				return;
			
			synchronization_context = SynchronizationContext.Current;

			// Check whether the current context is a plain SynchronizationContext object
			// and handle this as if no context was set at all.
			if (synchronization_context != null &&
				synchronization_context.GetType () == typeof(SynchronizationContext))
				synchronization_context = null;			
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:14,代码来源:__ComObject.cs

示例3: StartInitialization

		internal void StartInitialization ()
		{
			// Store the main sync context, since we'll need later on for subscribing
			// add-in extension points (Mono.Addins isn't currently thread safe)
			mainContext = SynchronizationContext.Current;
			
			// If there is no custom threading context, we can't use background initialization since
			// we have no main thread into which to dispatch
			backgroundInitialize = mainContext != null && mainContext.GetType () != typeof (SynchronizationContext);
			
			if (backgroundInitialize) {
				// Initialize the service in a background thread.
				initializing = true;
				Thread t = new Thread (new ThreadStart (BackgroundInitialize)) {
					Name = "Assembly service initialization",
					IsBackground = true,
				};
				t.Start ();
			}
		}
开发者ID:sparek,项目名称:monodevelop,代码行数:20,代码来源:TargetRuntime.cs


注:本文中的System.Threading.SynchronizationContext.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。