Hello All,
I have a question regardind=g accessing shared resources.
I have a for loop in which i am creating many threads..
And each thread at some point of time they call this function :
Public Function UpdateMailJobs(ByVal con As Data.DataRow, ByVal jobid As String, ByVal varName As String, ByVal value As String) As Boolean
mutJob.WaitOne()
Dim connection As New SQLManager.cls_SQLManager
connection.ConnectionString = CstrG(con("ConnectionString"))
connection.CommandText = "UPDATE MailJob SET " & varName & " = " & value & " Where JobID=" & jobid
registerError(con, "MailJob table update(updatemailjobs-fn1) finished(" & jobid & ")")
Try
connection.ExecuteNonQuery()
Catch ex As Exception
mutJob.ReleaseMutex()
Return False
End Try
mutJob.ReleaseMutex()
Return True
End Function
But i am not very sure weather this is correct or not ( Regarding the mutex i have used) . Can any one please advice ? Will this work perfectly even if there are 10 threads runinng at the same time ? Thanks in advance ..