473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to control a function and threads

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
1 922
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Thomas Barth | last post by:
Hi could someone explain to me why the compiler outputs a warning that the control reaches the end of a non void function? int main(void) { ... pthread_t thrCallOp, thrHangUp;...
5
by: Adam Clauss | last post by:
I am creating a plugin for MS Outlook. Upon clicking a toolbar button, I create series of threads (variable number each time). Within each thread, I start a form using Application.Run(...). This...
11
by: BoloBaby | last post by:
OK, check this out... I have a form with a panel control and button on it (outside the panel control). I have two event handlers - one handles the click event of the button on the form. The...
9
by: john doe | last post by:
I have a question about BeginInvoke method found on the Control class. To quote the docs: "Executes the specified delegate asynchronously with the specified arguments, on the thread that the...
0
by: Matt | last post by:
Ok so I'm creating this event scheduler in VB.NET with the use of threads. We would like the customer to be able to declare however many threads they want. For example... Lets say the user...
15
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
7
by: davetelling | last post by:
I'm a newbie that is still struggling with OOP concepts & how to make things work they way I want. Using Visual C# Express, I have a form in which I added a user control to display a graph, based...
44
by: climber.cui | last post by:
Hi all, Does anyone have experience on the thread-safty issue with malloc()? Some people said this function provided in stdlib.h is not thread- safe, but someone said it is thread safe. Is it...
12
by: joey.powell | last post by:
Hello, I have an app that uses a tab control with several tab pages. Sometimes some of the processing initiated on one of the tab pages gets busy doing stuff that is farmed out to worker...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.