<div>no one? how can i share variables in processing?</div>
<div>please help out!<br><br></div>
<div class="gmail_quote">On Thu, Apr 9, 2009 at 8:05 AM, <a href="mailto:rkmr.em@gmail.com">rkmr.em@gmail.com</a> <span dir="ltr"><<a href="mailto:rkmr.em@gmail.com">rkmr.em@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>hi <br>i am trying to move from threading to processing package. this is the controller i used to spawn new threads, and it used the global</div>
<div>variable done to check if it needs to spawn more threads or not. it worked great for me. it checks if there is new data to be processed every</div>
<div>30 seconds, and spawns of new threads to do the work, till all work is done.</div>
<div> </div>
<div> </div>
<div>but now in processing, anychange made to global variable done in sendalert method, is not reflected in the controller method.</div>
<div> </div>
<div>can please point out what is wrong?</div>
<div>thanks a lot!</div>
<div> </div>
<div> </div>
<div>code</div>
<div> </div>
<div> </div>
<div>done = False</div>
<div>def sendalert():</div>
<div>   global done</div>
<div>   users = q.get('xx')</div>
<div>   if not users:</div>
<div>     done = True</div>
<div>     return</div>
<div> </div>
<div>   done = False</div>
<div>   for u in users:</div>
<div>    do stuff</div>
<div> </div>
<div> </div>
<div>def control(number_threads_min=3, number_threads_max = 100):<br>    global done<br>    while True:<br>        number_threads = len(processing.activeChildren())<br>        if not done and number_threads<number_threads_max:<br>
            processing.Process(target=sendalert).start()<br>        if done and number_threads<number_threads_min:<br>            processing.Process(target=sendalert).start()</div>
<div>            time.sleep(30)</div>
<div> </div>
<div>if __name__ == '__main__':<br>    processing.Process(target=control).start()<br></div></blockquote></div><br>