BeginInvoke与EndInvoke方法解决多线程接收委托返回值问题
2015-03-06 19:55
405 查看
Public Delegate Function ParallelEvent() As Boolean '並列処理で行う Dim waitHandleList As New List(Of WaitHandle) For Each procedure As CSVLoadProcedure In _procedureList Dim parallelEvent As ParallelEvent = New ParallelEvent(AddressOf procedure.CSVFieldCheckByConv) Dim iAsyncResult As IAsyncResult = parallelEvent.BeginInvoke(Nothing, Nothing) If Not parallelEvent.EndInvoke(iAsyncResult) Then If Not procedure.LoadException Is Nothing Then WriteSystemErrorLog(procedure.LoadException) End If Return End If waitHandleList.Add(iAsyncResult.AsyncWaitHandle) Next 'すべての処理が終了するまで待機() WaitHandle.WaitAll(waitHandleList.ToArray()) If ExceptionExists() Then Throw New CRGaugeException("CSVFieldCheck") End Sub
参考
http://www.cnblogs.com/sufei/p/3140557.html
相关文章推荐
- BeginInvoke与EndInvoke方法解决多线程接收委托返回值问题
- BeginInvoke与EndInvoke方法解决多线程接收委托返回值问题
- BeginInvoke与EndInvoke方法解决多线程接收委托返回值问题
- C#多线程解决界面卡死问题的完美解决方案,BeginInvoke而不是委托delegate 转载
- 黄聪:C#多线程教程(1):BeginInvoke和EndInvoke方法,解决主线程延时Thread.sleep柱塞问题(转)
- 黄聪:C#多线程教程(1):BeginInvoke和EndInvoke方法,解决主线程延时Thread.sleep柱塞问题(转)
- 多线程委托之跨线程问题分析--在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke(解决方法已更新)
- ECG在DbCore使用实体更新Access数据库的时候返回值为0时的问题解决方法
- 多线程操作stl::map引起的数据不一致问题的解决过程与方法
- 多线程中生成随机数序列重复问题的解决方法
- Chrome中模态对话框showModalDialog返回值问题的解决方法
- VC8下多线程环境中AfxGetMainWnd()返回空指针问题及解决方法
- 匿名方法解决多线程访问控件的问题
- Chrome中模态对话框showModalDialog返回值问题的解决方法
- VC2008下多线程环境中AfxGetMainWnd()返回空指针问题及解决方法
- jQuery ajax return语句返回值无法接收问题解决方案
- JqueryEasyUI的DataGrid接收html内容后不显示问题的原因,解决方法
- 异步编程(AsyncCallback委托,IAsyncResult接口,BeginInvoke方法,EndInvoke方法)
- 异步编程(AsyncCallback委托,IAsyncResult接口,BeginInvoke方法,EndInvoke方法的使用小总结)
- AsyncCallback委托,IAsyncResult接口,BeginInvoke方法,EndInvoke方法小结