How to syncronize threads

bdani82

Member
Joined
Jun 7, 2004
Messages
22
Programming Experience
3-5
Hi!

I have a program with a FileSystemWatcher. Everytime a new file is created in my folder I create a new thread to read him.

Private Sub fSysWatcher_Changed(...) Handles oSysWatcher.Changed
oTh = New Thread(AddressOf ReadFile)
oTh.Name = e.Name
oTh.Start()
end sub

But I have a limit: if there are already 5 thread and a new file is created I want wait the end of one existing thread? How to di it?

Tks!:confused:
 
Ok. And if there are already 5 threads (shared property is 5) , how to wait the end of one of them before start the new thread? This is the problem.

Tks
 
Back
Top