I have a problem where I cannot lock or unlock a Mutex.
In VB.net, I set up my Mutexes:
Private mutDBP As New Threading.Mutex(False, "DBPlock")
Private mutVB As New Threading.Mutex(True, "VBlock")
First is for DBP to lock, second is defaulted to being locked by VB
The VB app starts, and creates the Mutexes. Then it starts the DBP app, which amongst other things tries to create a lock it's Mutex...
DBPobj = Find Free sysobj()
VBobj = Find Free sysobj()
make sysobj mutex VBobj, fb.VBlock
make sysobj mutex DBPobj, fb.DBPlock
lock = try lock sysobj(DBPobj)
It fails, but I can't
unlock sysobj.
While this is happening, my VB program is "watching" for the DBP program to be activated:
Try
result = mutDBP.WaitOne(0, False)
Catch
mutDBP.ReleaseMutex()
' an error is the same net effect as being able to lock the mutex
If Me.status <> eStatus.Connecting Then
If Me.status = eStatus.Connected Then
result = True
RaiseEvent Disconnected()
Me.status = eStatus.Disconnected
Exit Sub
End If
End If
End Try
My programs have failed during testing, and it's most likely that this has triggered the problem. However I'm concerned that a crash of my program may require a reboot to fix.
Can anyone give any advice on what I'm doing and how I should be doing it?