Question Atomic Operations or checking file for lock

rodgerwilco

New member
Joined
May 17, 2010
Messages
2
Programming Experience
3-5
Hi there,

I would like to know if there is any opportunity in VB.Net to use atomic operations. Or Maybe there is an opportunity to check if a file is allready in use or opened.
The reason why I ask is because I got a little application that I would like to log its actions. As the applications uses threads the method for writing the log file sometimes is trying to open the log-file more than once which leads to an exception.
anyone got an idea how to solve this?

greetz
rodgerwilco
 
Thank you for your answer. I will give it a try. But what about the second thread that is trying to access the file? Is this thread going to wait, till the first thread has left the block?
 
Thank you for your answer. I will give it a try. But what about the second thread that is trying to access the file? Is this thread going to wait, till the first thread has left the block?

Look first, ask questions later. If you read the documentation for the SyncLock statement then your question will be answered.
 
Back
Top