Python dummy_threading.BoundedSemaphore() Examples

The following are 10 code examples of dummy_threading.BoundedSemaphore(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module dummy_threading , or try the search function .
Example #1
Source File: test_dummy_threading.py    From medicare-demo with Apache License 2.0 6 votes vote down vote up
def test_main():
    # This takes about n/3 seconds to run (about n/3 clumps of tasks, times
    # about 1 second per clump).
    global numtasks
    numtasks = 10

    # no more than 3 of the 10 can run at once
    global sema
    sema = _threading.BoundedSemaphore(value=3)
    global mutex
    mutex = _threading.RLock()
    global running
    running = 0

    global threads
    threads = []

    starttasks()

    if verbose:
        print 'waiting for all tasks to complete'
    for t in threads:
        t.join()
    if verbose:
        print 'all tasks done' 
Example #2
Source File: test_dummy_threading.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #3
Source File: test_dummy_threading.py    From BinderFilter with MIT License 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #4
Source File: test_dummy_threading.py    From oss-ftp with MIT License 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #5
Source File: test_dummy_threading.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #6
Source File: test_dummy_threading.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #7
Source File: test_dummy_threading.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #8
Source File: test_dummy_threading.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #9
Source File: test_dummy_threading.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = [] 
Example #10
Source File: test_dummy_threading.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.numtasks = 10
        global sema
        sema = _threading.BoundedSemaphore(value=3)
        global mutex
        mutex = _threading.RLock()
        global running
        running = 0
        self.threads = []