1 import sys
2 import time
3 import ctypes
4 import threading
5
7 print '++ Hi! Im the new thread! (sleeping for 3)\n'
8 time.sleep(3)
9 print '++ Now Im going to memory fault (reading 0x41414141)\n'
10 try:
11 x = ctypes.string_at(0x41414141, 20)
12 except Exception, e:
13 print e
14 print '++ Sorry... my bad... ;)'
15 print '++ Now Im going to exit... (value 30)\n'
16 return 30
17
18
19 if __name__ == '__main__':
20
21
22 print '== You should see a thread create\n'
23 t = threading.Thread(target=dostuff)
24 t.setDaemon(True)
25 t.start()
26
27 print '== He should exit in a couple seconds (sleeping for 5)\n'
28 time.sleep(5)
29
30 print '== I will exit now...\n'
31