Created
December 9, 2014 17:57
-
-
Save ironpythonbot/1e4d73f617661d35f842 to your computer and use it in GitHub Desktop.
CodePlex Issue #32125 Plain Text Attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python imports | |
import traceback | |
import time | |
import threading | |
# .NET imports | |
from System.Threading.Tasks import Task | |
# Task method that simply accesses the current thread's name | |
def task_action(): | |
try: | |
print threading.current_thread().name | |
except: | |
print 'Ooops' | |
traceback.print_exc() | |
# Fire up tasks | |
for i in range(10): | |
Task.Factory.StartNew(task_action) | |
# Give some time for Tasks to finish so we get all the output. | |
time.sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment