+# Very rudimentary test of thread module
+# Create a bunch of threads, let each do some work, wait until all are done
+mutex = thread.allocate_lock()
+done = thread.allocate_lock()
+ delay = whrandom.random() * 10
+ print 'task', ident, 'will run for', delay, 'sec'
+ print 'task', ident, 'done'
+ global next_ident, running
+ next_ident = next_ident + 1
+ print 'creating task', next_ident
+ thread.start_new_thread(task, (next_ident,))
+print 'waiting for all tasks to complete'