main problem is i dont really understand threads, and at the moment they are my only option because im working on windows and it doesnt support fork processes.ran this program and all i got was a random integer ( 348 )
import thread
mutex=thread.al locate_lock()
f=open('newText .txt.','w')
def counter2(ID):
mutex.acquire()
f.write(ID,'\nN umbers are ')
for i in range(5): f.write(i)
f.write('\n')
mutex.release()
thread.start_ne w(counter2,(1,) )
...and and all i got was an integer which wasnt even supposed to appear (i understand that each thread when started they return a value which is supposed to be ignored), the file cointains nothing
import thread
mutex=thread.al locate_lock()
f=open('newText .txt.','w')
def counter2(ID):
mutex.acquire()
f.write(ID,'\nN umbers are ')
for i in range(5): f.write(i)
f.write('\n')
mutex.release()
thread.start_ne w(counter2,(1,) )
...and and all i got was an integer which wasnt even supposed to appear (i understand that each thread when started they return a value which is supposed to be ignored), the file cointains nothing
Comment