Mutex help

  • Thread starter Thread starter trialproduct2004
  • Start date Start date
T

trialproduct2004

hi all
I have one problem in vb.net application.
I am having two threads which are starting at the same time.
Both these threads are reading one file and retrieving data from same
file.
When one thread start and during retrieving information from file, if i
abort thread then second thread is getting affected and is going to
infinite loop.

To allow only one thread to get access to file, should i use mutex
before starting actual reading of file.
Is it correct way. Please tell me when should i use mutex.
Please help me.

Thanks in advance.
 
Hi,

Take a look a synclock
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmsynclock.asp

Ken
-----------------
hi all
I have one problem in vb.net application.
I am having two threads which are starting at the same time.
Both these threads are reading one file and retrieving data from same
file.
When one thread start and during retrieving information from file, if i
abort thread then second thread is getting affected and is going to
infinite loop.

To allow only one thread to get access to file, should i use mutex
before starting actual reading of file.
Is it correct way. Please tell me when should i use mutex.
Please help me.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Controlling Threads With MUTEX 1
mutex 4
Problem with mutex 1
Mutex 3
Mutex access denied 2
ThreadPool and WaitHandle 1
Mutex problem 8
threading & mutex: question about example 2

Back
Top