[issue8800] add threading.RWLock

Richard Oudkerk report at bugs.python.org
Mon Oct 1 11:52:23 CEST 2012


Richard Oudkerk added the comment:

> @richard: I'm sorry, but both of my patches contain changes to 
> 'Lib/threading.py' and can be applied on top of Python 3.3.0. So can you 
> explain what do you mean, by missing the changes to threading.py?

I was reading the Rietveld review page

    http://bugs.python.org/review/8800/#ps6111

which only shows changes to multiprocessing/__init__.py and multiprocessing/synchronize.py.

The patch looks like it was produced using git rather than hg, so perhaps Rietveld got confused by this.  In that case it is a bug in Rietveld that it produced a partial review instead of producing no review.

> # unpack the the object into two variables and pass them separately around
> shrd_lock, excl_lock = ShrdExclLock()
> 
> Thread(target=reader, args=(shrd_lock,)).start()
> Thread(target=writer, args=(excl_lock,)).start)

Although using namedtuple is probably a good idea, I don't think it really adds much flexibility.  This example could just as easily be written

  selock = ShrdExclLock()

  Thread(target=reader, args=(selock.shared,)).start()
  Thread(target=writer, args=(selock.exclusive,)).start)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8800>
_______________________________________


More information about the Python-bugs-list mailing list