<br>Hi All,<br><br>Is there is a way to print or use the value of new in the main function of the script below?<br><br><br>from thread import start_new_thread, allocate_lock<br><br>num_threads = 0<br>thread_started = False<br>
lock = allocate_lock()<br><br>def heron(a):<br> global num_threads, thread_started<br> lock.acquire()<br> num_threads += 1<br> thread_started = True<br> lock.release()<br> """Calculates the square root of a"""<br>
eps = 0.0000001<br> old = 1<br> new = 1<br> while True:<br> old,new = new, (new + a/new) / 2.0<br> print old, new<br> if abs(new - old) < eps:<br> break<br> lock.acquire()<br>
num_threads -= 1<br> lock.release()<br> return new<br><br>start_new_thread(heron,(81,))<br>start_new_thread(heron,(999,))<br>start_new_thread(heron,(1733,))<br><br><br>while not thread_started:<br> pass<br>while num_threads > 0:<br>
pass<br><br>Thanks,<br><br>Moses.<br>