I try again in a new thread, the other went out of hand.
I use this code line to create a n value.
n = random.randint(0, 99), i use this n value as a lap index to my while loop. The loop is in a function called "def run(self)" in a class called "class P(thread)". Each lap create one element that is stored in the global variable "num", "num" have a start value = 0. I use this code to add elements to "num":
while n >= 0: x = random.randint(0,99) print x, num = num +x time.sleep(.30) n = n-1
My second class is called "classC(thread)".
This class is not within "class P(thread)".
This class use m = random.randint(0, 99), i use this m value as a lap index to my while loop in this class. It also have "def run(self)".
Each lap subtract from "num" using this code:
while m>=0: x = random.randint(0,99) print x, num = num -x if num >= 0: time.sleep(.15) m = m-1 else: print "" print "Wait, not enough !" break num = num +x
My question is, how do i make this loop wait until there is enough in "num"? I want the loop in class P(thread) ge more time to create more data in "num" then the 2nd loop will continue.
A bit simpler,how can force loop1 in classP to start again and create more data after the BREAK.
Example: P create these numbers 10 20 30 if i add them i get a value 60. Then C starts and get these numbers 20 20 30 =>70.
Total 60-70= -10 i dont want a negative value ever, i want to create more data instead of a BREAK.
I hope this is clearer and yes i will use locks as well but this is enough for now.
Help please, thanks for your time.