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


C# WaitCallback.IsTransparentProxy方法代码示例

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


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

示例1: QueueUserWorkItem

		public static bool QueueUserWorkItem (WaitCallback callBack, object state)
		{
			if (callBack == null)
				throw new ArgumentNullException ("callBack");

			if (callBack.IsTransparentProxy ()) {
				IAsyncResult ar = callBack.BeginInvoke (state, null, null);
				if (ar == null)
					return false;
			} else {
				AsyncResult ares = new AsyncResult (callBack, state, true);
				pool_queue (ares);
			}
			return true;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:15,代码来源:ThreadPool.cs

示例2: QueueUserWorkItem

		public static bool QueueUserWorkItem (WaitCallback callBack, object state)
		{
			if (callBack == null)
				throw new ArgumentNullException ("callBack");

#if MOONLIGHT
			callBack = MoonlightHandler (callBack);
#endif
			if (callBack.IsTransparentProxy ()) {
				IAsyncResult ar = callBack.BeginInvoke (state, null, null);
				if (ar == null)
					return false;
			} else {
				if (!callBack.HasSingleTarget)
					throw new Exception ("The delegate must have only one target");

				AsyncResult ares = new AsyncResult (callBack, state, true);
				pool_queue (ares);
			}
			return true;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:21,代码来源:ThreadPool.cs

示例3: UnsafeQueueUserWorkItem

		public static bool UnsafeQueueUserWorkItem (WaitCallback callBack, object state)
		{
			// no stack propagation here (that's why it's unsafe and requires extra security permissions)
			if (!callBack.IsTransparentProxy ()) {
				if (!callBack.HasSingleTarget)
					throw new Exception ("The delegate must have only one target");

				AsyncResult ares = new AsyncResult (callBack, state, false);
				pool_queue (ares);
				return true;
			}
			try {
				if (!ExecutionContext.IsFlowSuppressed ())
					ExecutionContext.SuppressFlow (); // on current thread only
				IAsyncResult ar = callBack.BeginInvoke (state, null, null);
				if (ar == null)
					return false;
			} finally {
				if (ExecutionContext.IsFlowSuppressed ())
					ExecutionContext.RestoreFlow ();
			}
			return true;
		}
开发者ID:carrie901,项目名称:mono,代码行数:23,代码来源:ThreadPool.cs

示例4: UnsafeQueueUserWorkItem

		public static bool UnsafeQueueUserWorkItem (WaitCallback callBack, object state)
		{
			if (Microsoft.ThreadPool.UseMicrosoftThreadPool) {
				return Microsoft.ThreadPool.UnsafeQueueUserWorkItem (callBack, state);
			} else {
				if (callBack == null)
					throw new ArgumentNullException ("callBack");

				// no stack propagation here (that's why it's unsafe and requires extra security permissions)
				if (!callBack.IsTransparentProxy ()) {
					AsyncResult ares = new AsyncResult (callBack, state, false);
					pool_queue (ares);
					return true;
				}
				try {
					if (!ExecutionContext.IsFlowSuppressed ())
						ExecutionContext.SuppressFlow (); // on current thread only
					IAsyncResult ar = callBack.BeginInvoke (state, null, null);
					if (ar == null)
						return false;
				} finally {
					if (ExecutionContext.IsFlowSuppressed ())
						ExecutionContext.RestoreFlow ();
				}
				return true;
			}
		}
开发者ID:psni,项目名称:mono,代码行数:27,代码来源:ThreadPool.cs

示例5: QueueUserWorkItem

		public static bool QueueUserWorkItem (WaitCallback callBack, object state)
		{
			if (Microsoft.ThreadPool.UseMicrosoftThreadPool) {
				return Microsoft.ThreadPool.QueueUserWorkItem (callBack, state);
			} else {
				if (callBack == null)
					throw new ArgumentNullException ("callBack");

				if (callBack.IsTransparentProxy ()) {
					IAsyncResult ar = callBack.BeginInvoke (state, null, null);
					if (ar == null)
						return false;
				} else {
					AsyncResult ares = new AsyncResult (callBack, state, !ExecutionContext.IsFlowSuppressed());
					pool_queue (ares);
				}
				return true;
			}
		}
开发者ID:psni,项目名称:mono,代码行数:19,代码来源:ThreadPool.cs


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