<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hi Benjamin and folks:</span></div><div><br><span></span></div><div><span>Thanks for the response. I made the change to ll_new_start_thread. Still I get the Ambiguous low-level helper specialization error.</span><br><br></div><div><span>The programme is small. Here is the programme in its entirety. Hopefully it is a silly error. Any help would be appreciated.</span></div><div><br><span></span></div><div><span>Cheers,</span></div><div><span>Andrew<br></span></div><div>-------<br></div><div>import time<br>from pypy.module.thread import ll_thread<br>from pypy.translator.stm import rstm<br><br>NUM_THREADS = 2<br><br>class Account(object):<br>&nbsp;&nbsp;&nbsp; def __init__(self, value):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.value = value<br><br>class Done(object):<br>&nbsp;&nbsp;&nbsp; def
 __init__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.done = 0<br><br>fromAccount = Account(1000)<br>toAccount = Account(2000)<br>counter = Done()<br><br><br>def transactionA(source, target, done):<br>&nbsp;&nbsp;&nbsp; print "transaction A starting"<br>&nbsp;&nbsp;&nbsp; source.value -= 50<br>&nbsp;&nbsp;&nbsp; target.value += 50<br>&nbsp;&nbsp;&nbsp; rstm.transaction_boundary()<br>&nbsp;&nbsp;&nbsp; print "Source account %d&nbsp; TargetAccount %d" % (source.value,target.value)<br>&nbsp;&nbsp;&nbsp; print "transaction A done"<br>&nbsp;&nbsp;&nbsp; done.done += 1 <br><br><br>def transactionB(source, target, done):<br>&nbsp;&nbsp;&nbsp; print "transaction B starting"<br>&nbsp;&nbsp;&nbsp; t = source.value * .1<br>&nbsp;&nbsp;&nbsp; source.value -= t<br>&nbsp;&nbsp;&nbsp; target.value += t<br>&nbsp;&nbsp;&nbsp; rstm.transaction_boundary()<br>&nbsp;&nbsp;&nbsp; print "Source account %d&nbsp; Target %d" % (source.value,
 target.value)<br>&nbsp;&nbsp;&nbsp; print "transaction A done"<br>&nbsp;&nbsp;&nbsp; done.done += 1<br><br><br>def T1():<br>&nbsp;&nbsp;&nbsp; #global fromAccount, toAccount, counter<br>&nbsp;&nbsp;&nbsp; transactionA(fromAccount, toAccount, counter)<br><br><br>def T2():<br>&nbsp;&nbsp;&nbsp; #global fromAccount, toAccount, counter<br>&nbsp;&nbsp;&nbsp; transactionB(fromAccount, toAccount, counter)<br><br># __________&nbsp; Entry point&nbsp; __________<br><br>def entry_point(argv):<br>&nbsp;&nbsp;&nbsp; ll_thread.start_new_thread(T1,())<br>&nbsp;&nbsp;&nbsp; ll_thread.start_new_thread(T2,())<br>&nbsp;&nbsp;&nbsp; #ll_thread.ll_start_new_thread(T1)<br>&nbsp;&nbsp;&nbsp; #ll_thread.ll_start_new_thread(T2)<br>&nbsp;&nbsp;&nbsp; print "sleeping..."<br>&nbsp;&nbsp;&nbsp; while counter.done &lt; NUM_THREADS:&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time.sleep(1)<br>&nbsp;&nbsp;&nbsp; print "done sleeping."<br><br>&nbsp;&nbsp;&nbsp; # easy
 way to know if transactions are being serialized correctly<br>&nbsp;&nbsp;&nbsp; assert fromAccount.value + toAccount.value == 3000 <br>&nbsp;&nbsp;&nbsp; return 0<br><br># _____ Define and setup target ___<br><br>def target(*args):<br>&nbsp;&nbsp;&nbsp; return entry_point,
 None<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><span></span></div><div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br
><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><b
r><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>def T2():<br>&nbsp;&nbsp;&nbsp; global fromAccount, toAccount, counter<br>&nbsp;&nbsp;&nbsp; transactionB(fromAccount, toAccount, counter)<br><br># __________&nbsp; Entry point&nbsp; __________<br><br>def entry_point(argv):<br>&nbsp;&nbsp;&nbsp; global fromAccount, toAccount, counter<br>&nbsp;&nbsp;&nbsp; #ll_thread.start_new_thread(T1,())<br>&nbsp;&nbsp;&nbsp; #ll_thread.start_new_thread(T1,())<br>&nbsp;&nbsp;&nbsp; ll_thread.ll_start_new_thread(T1)<br>&nbsp;&nbsp;&nbsp; ll_thread.ll_start_new_thread(T2)<br>&nbsp;&nbsp;&nbsp; print "sleeping..."<br>&nbsp;&nbsp;&nbsp; while counter.done &lt; NUM_THREADS:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time.sleep(1)<br>&nbsp;&nbsp;&nbsp; print "done sleeping."<br>&nbsp;&nbsp;&nbsp; assert fromAccount.value + toAccount.value == 3000<br>&nbsp;&nbsp;&nbsp; return 0<br><br># _____ Define and
 setup target ___<br><br>def target(*args):<br>&nbsp;&nbsp;&nbsp; return entry_point, None<br><br><br><br><span></span></div><div><br><span></span></div><div><span><br></span></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight: bold;">From:</span></b> Benjamin Peterson &lt;benjamin@python.org&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Andrew Francis &lt;andrewfr_ice@yahoo.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> "pypy-dev@codespeak.net" &lt;pypy-dev@codespeak.net&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, January 23, 2012 5:23 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [pypy-dev] What Causes An Ambiguous low-level helper specialization Error?<br> </font> </div> <br>
2012/1/23 Andrew Francis &lt;<a ymailto="mailto:andrewfr_ice@yahoo.com" href="mailto:andrewfr_ice@yahoo.com">andrewfr_ice@yahoo.com</a>&gt;:<br>&gt; &nbsp;&nbsp;&nbsp; ll_thread.start_new_thread(T1)<br>&gt; &nbsp;&nbsp;&nbsp; ll_thread.start_new_thread(T2)<br><br>Try this:<br>&nbsp; &nbsp;  ll_thread.ll_start_new_thread(T1)<br>&nbsp; &nbsp;  ll_thread.ll_start_new_thread(T2)<br><br><br><br><br>-- <br>Regards,<br>Benjamin<br><br><br> </div> </div>  </div></body></html>