本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}