本文介绍了帮助线程池???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 亲爱的, 我有一个我需要在一个线程中运行的函数,因为它可以 需要很长时间才能执行根据要收集的数据量。 此功能还填充了一个树形视图控件,当收集的数据完成后, 完成。 为了实现这个目的,我使用了以下代码: System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf GetListOfReelsFromRemoteDB)) ===>> private sub GetListOfReelsFromRemoteDB m_objRemoteHist =新的远程(m_sRemoteDbPath) m_objRemoteHist.Read() Dim sParam(0)As Object sParam(0)= m_objRemoteHist tLogView.Invoke(AddReels,sParam) Me.Cursor = Cursors.Default end sub << === Read例程,co从远程数据库中选择数据 当Read返回时,它使用调用使用delagate对象填充树视图控件 。 我遇到的问题是当tLogView.Invoke(AddReels,sparam)执行时,它会释放我的整个应用程序并获得无响应状态。我猜那里 shuld线程队列过程有问题,但不知道为什么 以及如何解决它 有没有人可以帮忙? 问候 serge Dear all, I have a function that I need to run in a thread due to the fact that it cantakes long time to execute according to the amount of data to collect.This function is also populating a treeview control whne collected data getsfinished. In order to achieve this I have used the following code :System.Threading.ThreadPool.QueueUserWorkItem(NewSystem.Threading.WaitCallback(AddressOf GetListOfReelsFromRemoteDB)) Then my function definition is as follow : ===>>private sub GetListOfReelsFromRemoteDBm_objRemoteHist = New Remote(m_sRemoteDbPath) m_objRemoteHist.Read()Dim sParam(0) As Object sParam(0) = m_objRemoteHisttLogView.Invoke(AddReels, sParam)Me.Cursor = Cursors.Defaultend sub<<=== The Read routine, collect data froma remote databaseWhen Read return, it populates a tree view control with a delagate object byusing the Invoke. Problem I have is that when tLogView.Invoke(AddReels,sparam) execute, itfrees my whole application and gets "no responding status". I guess thereshuld be something wrong with the thread queue process but do not know whyand how to solve it Does anyone could help ? regardsserge推荐答案 这篇关于帮助线程池???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-18 14:36