Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python3
- """
- Spyder Editor
- This is a temporary script file.
- """
- from multiprocessing import Process
- def threadFunction():
- i=1
- while (i > 0):
- print(i)
- i += 1
- #def __main__():
- if __name__ == '__main__':
- # Esegui codice
- print('Main started')
- thread = Process(target = threadFunction)
- thread.start()
- print('Thread started')
- print('Waiting...')
- thread.join(5)
- if(thread.is_alive()):
- thread.terminate()
- print('Processo killato')
- input('Press enter to get out of here...')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement