本文整理汇总了C#中WorkerThread.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# WorkerThread.Invoke方法的具体用法?C# WorkerThread.Invoke怎么用?C# WorkerThread.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkerThread
的用法示例。
在下文中一共展示了WorkerThread.Invoke方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
//.........这里部分代码省略.........
new { }.With(
async delegate
{
var vw = ow;
var vh = oh;
#region 3 workers
// what about sending bytes[2,3] over?
byte[] rgba_bytes0in = null;
var rgba_bytes0in_set = new System.Threading.SemaphoreSlim(1);
byte[] rgba_bytes0out = null;
var rgba_bytes0out_set = new System.Threading.SemaphoreSlim(1);
//SemaphoreSlim rgba_bytes0out_set = new __SemaphoreSlim(1) { Name = "rgba_bytes0out_set" };
byte[] rgba_bytes1in = null;
var rgba_bytes1in_set = new System.Threading.SemaphoreSlim(1);
byte[] rgba_bytes1out = null;
var rgba_bytes1out_set = new System.Threading.SemaphoreSlim(1);
byte[] rgba_bytes2in = null;
var rgba_bytes2in_set = new System.Threading.SemaphoreSlim(1);
byte[] rgba_bytes2out = null;
var rgba_bytes2out_set = new System.Threading.SemaphoreSlim(1);
Task.Run(
async delegate
{
var w = new WorkerThread(0, vw, vh);
next:
await rgba_bytes0in_set.WaitAsync();
rgba_bytes0out = w.Invoke(rgba_bytes0in);
rgba_bytes1out = null;
rgba_bytes2out = null;
rgba_bytes0in = null;
rgba_bytes1in = null;
rgba_bytes2in = null;
// we should not sync back data we did not put there. nor should it be there anyway?
rgba_bytes0out_set.Release();
goto next;
}
);
Task.Run(
async delegate
{
var w = new WorkerThread(1, vw, vh);
next:
await rgba_bytes1in_set.WaitAsync();
rgba_bytes0out = null;
rgba_bytes1out = w.Invoke(rgba_bytes1in);
rgba_bytes2out = null;
rgba_bytes0in = null;
rgba_bytes1in = null;
rgba_bytes2in = null;
rgba_bytes1out_set.Release();
goto next;
}
);