Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07af9a7

Browse files
committed
Add a sleep(0.00001) call to make sure all threads run.
1 parent 2830dcc commit 07af9a7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Demo/threads/find.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def _donework(self):
7777
self.mutex.release()
7878

7979
def _worker(self):
80+
time.sleep(0.00001) # Let other threads run
8081
while 1:
8182
job = self._getwork()
8283
if not job:
@@ -97,6 +98,7 @@ def run(self, nworkers):
9798
# Main program
9899

99100
def main():
101+
sys.argv.append("/tmp")
100102
nworkers = 4
101103
opts, args = getopt.getopt(sys.argv[1:], '-w:')
102104
for opt, arg in opts:

0 commit comments

Comments
 (0)