By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,888 Members | 1,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,888 IT Pros & Developers. It's quick & easy.

How to control a function and threads

P: n/a
Dear colleagues

I have a simple function which calls through a function some threads. The
function looks like follow:

Private Sub Refresh( )

Call_ManyOtherThreads_Function(ToDo ) '--> This function creates some
threads
'--> Here I want now to stop the sub until the first call of
Call_ManyOtherThreads_Function( ) is finished.
Call_ManyOtherThreads_Function(ToDo ) '--> This function creates some
threads

End Sub

As you see in the comment, I want to let first finish the first function and
then to call the second function. I tried the following but it doesn't work:

Private Shared mutCon as New Mutex()

Private Sub Refresh( )
mutCon.WaitOne()
Call_ManyOtherThreads_Function( ToDo) ' ---> The last Thread calls the
function mutCon.ReleaseMutex()
'--> Unfortunatelly the Mutex doesn't stop
mutCon.WaitOne()
Call_ManyOtherThreads_Function( ToDo) ' ---> The last Thread calls the
function mutCon.ReleaseMutex()

End Sub

So what am I doing wrong and how can I do this?
Thanks Alex
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Alex,

I think you are searching for the methods on this page

http://msdn.microsoft.com/library/de...eadpooling.asp

I hope this helps?

Cor
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.