Re: TextWriter synchronized method

Tech-Archive recommends: Speed Up your PC by fixing your registry



"fniles" <fniles@xxxxxxxxxx> wrote in
news:emnkuKa6HHA.1188@xxxxxxxxxxxxxxxxxxxx:

If I use TextWriter synchronized method like below codes if another
thread is trying to write at the same time, what will happen ?

I believe it will block until the first thread releases the write.


Synchronized methods implement a simple synclock mechanism if I'm not
mistaken.

Will it
the 2nd thread request to write to the file be queued ? Will the 2nd
thread then stop processing other codes while waiting to write to this
file ?

Thank you.

Dim swLogOrig As StreamWriter
Dim swLog As TextWriter

swLogOrig = New StreamWriter(m_sLogFileName, True)
swLog = TextWriter.Synchronized(swLogOrig)




.