Skip to content

Instantly share code, notes, and snippets.

@ironpythonbot
Created December 9, 2014 17:57
Show Gist options
  • Save ironpythonbot/1e4d73f617661d35f842 to your computer and use it in GitHub Desktop.
Save ironpythonbot/1e4d73f617661d35f842 to your computer and use it in GitHub Desktop.
CodePlex Issue #32125 Plain Text Attachments
# 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