Back to index

python3.2  3.2.2
Public Member Functions
test.test_dummy_threading.DummyThreadingTestCase.TestThread Class Reference

List of all members.

Public Member Functions

def run

Detailed Description

Definition at line 8 of file test_dummy_threading.py.


Member Function Documentation

Definition at line 10 of file test_dummy_threading.py.

00010 
00011         def run(self):
00012             global running
00013             global sema
00014             global mutex
00015             # Uncomment if testing another module, such as the real 'threading'
00016             # module.
00017             #delay = random.random() * 2
00018             delay = 0
00019             if support.verbose:
00020                 print('task', self.name, 'will run for', delay, 'sec')
00021             sema.acquire()
00022             mutex.acquire()
00023             running += 1
00024             if support.verbose:
00025                 print(running, 'tasks are running')
00026             mutex.release()
00027             time.sleep(delay)
00028             if support.verbose:
00029                 print('task', self.name, 'done')
00030             mutex.acquire()
00031             running -= 1
00032             if support.verbose:
00033                 print(self.name, 'is finished.', running, 'tasks are running')
00034             mutex.release()
00035             sema.release()
00036 
    def setUp(self):

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: