This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # -*- coding: UTF-8 -*- | |
| import queue as Queue | |
| import threading | |
| import time | |
| exitFlag = 0 | |
| class myThread (threading.Thread): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from threading import Thread | |
| import queue | |
| import time | |
| # q是任务队列 | |
| #NUM是并发线程总数 | |
| #JOBS是有多少任务 | |
| q = queue.Queue() | |
| NUM = 2 | |
| JOBS = 10 | |
| #具体的处理函数,负责处理单个任务 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- |
NewerOlder