TextWriter synchronized method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fniles

    #1

    TextWriter synchronized method

    If I use TextWriter synchronized method like below codes if another thread
    is trying to write at the same time, what will happen ? 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.Sync hronized(swLogO rig)


  • Spam Catcher

    #2
    Re: TextWriter synchronized method

    "fniles" <fniles@pfmail. comwrote in
    news:emnkuKa6HH A.1188@TK2MSFTN GP04.phx.gbl:
    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.Sync hronized(swLogO rig)
    >
    >
    >

    Comment

    Working...