Changeset 391 for python/trunk/Lib/multiprocessing/synchronize.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/multiprocessing/synchronize.py
r2 r391 4 4 # multiprocessing/synchronize.py 5 5 # 6 # Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt 6 # Copyright (c) 2006-2008, R Oudkerk 7 # All rights reserved. 8 # 9 # Redistribution and use in source and binary forms, with or without 10 # modification, are permitted provided that the following conditions 11 # are met: 12 # 13 # 1. Redistributions of source code must retain the above copyright 14 # notice, this list of conditions and the following disclaimer. 15 # 2. Redistributions in binary form must reproduce the above copyright 16 # notice, this list of conditions and the following disclaimer in the 17 # documentation and/or other materials provided with the distribution. 18 # 3. Neither the name of author nor the names of any contributors may be 19 # used to endorse or promote products derived from this software 20 # without specific prior written permission. 21 # 22 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND 23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 # SUCH DAMAGE. 7 33 # 8 34 … … 59 85 self.acquire = self._semlock.acquire 60 86 self.release = self._semlock.release 61 self.__enter__ = self._semlock.__enter__ 62 self.__exit__ = self._semlock.__exit__ 87 88 def __enter__(self): 89 return self._semlock.__enter__() 90 91 def __exit__(self, *args): 92 return self._semlock.__exit__(*args) 63 93 64 94 def __getstate__(self): … … 182 212 self._make_methods() 183 213 214 def __enter__(self): 215 return self._lock.__enter__() 216 217 def __exit__(self, *args): 218 return self._lock.__exit__(*args) 219 184 220 def _make_methods(self): 185 221 self.acquire = self._lock.acquire 186 222 self.release = self._lock.release 187 self.__enter__ = self._lock.__enter__188 self.__exit__ = self._lock.__exit__189 223 190 224 def __repr__(self): … … 193 227 self._woken_count._semlock._get_value()) 194 228 except Exception: 195 num_waiters = 'unk own'229 num_waiters = 'unknown' 196 230 return '<Condition(%s, %s)>' % (self._lock, num_waiters) 197 231 … … 302 336 else: 303 337 self._cond.wait(timeout) 338 339 if self._flag.acquire(False): 340 self._flag.release() 341 return True 342 return False 304 343 finally: 305 344 self._cond.release()
Note:
See TracChangeset
for help on using the changeset viewer.