prwlock: keep a count of how many locks were issue to prevent native errors
prwlock: keep a count of how many locks were issue to prevent native errors

On Linux amd64, if you try to release a lock that has never been acquired, you
end up with a crash of the Python interpreter. Such as in this session:

    $ python
    Python 3.5.0 (default, Sep 20 2015, 11:28:25)
    [GCC 5.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from prwlock.prwlock import RWLock
    >>> r = RWLock()
    >>> r.release()
    [1]    12097 illegal hardware instruction (core dumped)  python

The reason for this happening is that, as pthread_rwlock_unlock()'s
documentation says, "Results are undefined if the read-write lock rwlock is not
held by the calling thread". Therefore, we keep a local count and raise
a ValueError when the user tries to release an unlocked rwlock

trovao/prwlock