On Wed, Apr 8, 2015 at 12:08 PM, Ignacio Grande <
ncc17...@gmail.com> wrote:
> Hello.
>
> I have this small program that shows a weird behaviour while using RWMutex:
>
http://play.golang.org/p/bhrY_W5F1z
>
> From the documentation, I expected that the Unlock operation in the
> goroutine would cause a runtime error (because it is RLocked, not Locked),
> but somehow it is Unlocked.
This misuse is detected only probabilistically. If you runt he
following program with GOMAXPROCS>1 it crashes eventually with "panic:
sync: Unlock of unlocked RWMutex":
http://play.golang.org/p/kgW1mmY-la
Non-probabilistic detection will slowdown correct programs.
> In addition, I can RLock it even if there is a
> pending Lock operation that is not completed (it should be blocked until the
> Lock is acquired and released).
I don't understand this part. The program misuses mutex, so it's
behavior is all broken.
Can you provide a correct program that demonstrates the problem?
> Is this a bug or am I missing something? What is the status of the lock
> while the Tick is working?
>
> Regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.