寻找代码来实现这个简单的异步示例

时间:2016-05-28 15:53:41

标签: asynchronous

我正在寻找一个简单的异步代码示例(最好在VB中使用.NET)来做这样的事情:

Main()
 async Sub1()
 async Sub2()
 await Sub1()
 print "end"
End

Sub1()
 for n=1 to 1000
  { do something }
 next
End sub

Sub2()
 if n=500 in Sub1() then print "Hello"
End sub

另一种选择可能是:

Main()
 async Sub1()
 async Sub2()
 await Sub1()
 print "end"
End

Sub1()
 for n=1 to 1000
  if n=500 send signal
  { do something }
 next
End Sub

Sub2()
 if signal is received print "Hello"
End Sub

0 个答案:

没有答案