C
cj
I want to make a class that will write data to a in memory table. This
class will be called by multiple threads. I'm hoping the table can stay
in memory between calls and all the call by the thread will have to do
is pass some data to be added to the table. Kinda like this class I
have to write to a log file.
Public Class MyStringLogger
Private Shared m_loglock As New Object
Public Shared Sub Write(ByVal fileName As String, ByVal strToWrite
As String)
SyncLock (m_loglock)
Try
Dim sw As New System.io.StreamWriter(fileName, True)
sw.WriteLine(strToWrite)
sw.Close()
Catch
End Try
End SyncLock
End Sub
End Class
Any idea how I'd do this?
class will be called by multiple threads. I'm hoping the table can stay
in memory between calls and all the call by the thread will have to do
is pass some data to be added to the table. Kinda like this class I
have to write to a log file.
Public Class MyStringLogger
Private Shared m_loglock As New Object
Public Shared Sub Write(ByVal fileName As String, ByVal strToWrite
As String)
SyncLock (m_loglock)
Try
Dim sw As New System.io.StreamWriter(fileName, True)
sw.WriteLine(strToWrite)
sw.Close()
Catch
End Try
End SyncLock
End Sub
End Class
Any idea how I'd do this?