Negative Mutex Reader Counter

Hello, I have encountered a problem and I believe its related to Mutex or something.
I have made several Get functions that locks/unlocks a RWMutex and they work as intended for most parts.

But now I have stumbled across an issue, that I can’t seem to figure out, so I started debugging and I found this:
&sync.RWMutex{w:sync.Mutex{state:1, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:-1073741823, readerWait:0}

Is it normal that the readerCounter is negative and if not, what could be the cause for it?
I have checked that all my Lock/RLock gets closed either after getting the value or with a defer.
If its normal to have a negative readerCounter then I will have to debug it more…

I managed to solve it, the problem was that I was calling some Get Functions inside one of my Remove functions.
Which means I was calling RLocks inside of a Lock, so I assume that I was never calling Unlock.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.