[pypy-svn] r22886 - pypy/dist/pypy/lib/logic/basic_store
auc at codespeak.net
auc at codespeak.net
Tue Jan 31 11:54:49 CET 2006
Author: auc
Date: Tue Jan 31 11:54:26 2006
New Revision: 22886
Modified:
pypy/dist/pypy/lib/logic/basic_store/test_unification.py
pypy/dist/pypy/lib/logic/basic_store/unification.py
Log:
* unification status update
* test for threads waitind on unbound variable
Modified: pypy/dist/pypy/lib/logic/basic_store/test_unification.py
==============================================================================
--- pypy/dist/pypy/lib/logic/basic_store/test_unification.py (original)
+++ pypy/dist/pypy/lib/logic/basic_store/test_unification.py Tue Jan 31 11:54:26 2006
@@ -188,6 +188,27 @@
assert (t2.raised and not t1.raised) or \
(t1.raised and not t2.raised)
+ def test_threads_waiting_for_unbound_var(self):
+ import time
+ start_time = time.time()
+
+ def wait_on_unbound(thread, var, start_time):
+ thread.val = var.get()
+ thread.waited = time.time() - start_time
+
+ x = u.var('x')
+ t1, t2 = (FunThread(wait_on_unbound, x, start_time),
+ FunThread(wait_on_unbound, x, start_time))
+ t1.start()
+ t2.start()
+ time.sleep(1)
+ u.bind(x, 42)
+ t1.join()
+ t2.join()
+ assert t1.val == 42
+ assert t2.val == 42
+ assert t1.waited > 1
+ assert t2.waited > 1
def test_set_var_domain(self):
x = u.var('x')
Modified: pypy/dist/pypy/lib/logic/basic_store/unification.py
==============================================================================
--- pypy/dist/pypy/lib/logic/basic_store/unification.py (original)
+++ pypy/dist/pypy/lib/logic/basic_store/unification.py Tue Jan 31 11:54:26 2006
@@ -112,11 +112,7 @@
# * understand this :
# http://www.mozart-oz.org/papers/abstracts/ProgrammingConstraintServices.html
# * support '_' as shown above
-# * turn Var into some dataflow-ish thing (as far as Python allows)
-# * ensure that the store supports concurrent access
-# (using the implicit blocking provided by dataflow vars)
# * add entailment checks
-# * add constraints support
import threading
More information about the Pypy-commit
mailing list