Please consider the following code:
from multiprocessing import Process
import time
myArray = []
def myThread():
counter = 0
global myArray
while True:
myArray.append(counter)
time.sleep(1)
counterThread = Process(target=myThread,)
counterThread.start()
while True:
if len(myArray) > 0:
print "Success"
else:
print ":("
print myArray
time.sleep(1)
I am unable to get my success message, and i'm not sure why, I keep receiving :( and my terminal printing an empty array. I thought making the array global would mean any changes made at myThread() level would be applied?