[Python-ideas] channel (synchronous queue)

Antoine Pitrou solipsis at pitrou.net
Sun Feb 19 18:18:52 CET 2012


On Sun, 19 Feb 2012 17:58:53 +0100
Sturla Molden <sturla at molden.no> wrote:
> 
>      def put(self, msg):
>          with self._writelock:
>              self._data = msg
>              self._new_data.set()
>              self._recv_data.wait()
>              self._recv_data.clear()

This begs the question: what does it achieve? You know that the data
has been "received" on the other side (i.e. get() has been called),
but this doesn't tell you anything was done with the data, so: why is
this an useful way to synchronize?

Regards

Antoine.





More information about the Python-ideas mailing list