Python 多线程是多鸡肋

摘要:

Python 对并行化支持的名声就不是很好,如果你用过 Python 自带的线程库 thread 和 threading,你应该知道 Python 线程其实并不好用。例如:没有自带的获取线程返回值的方法,需要自己重写自己的threading。

目录:

  1. Python 多线程 基础
  2. Python 多线程 阻塞
  3. Python 多线程 获取返回值
  4. Python 多线程 数据对比测试

正文:
一. Python 多线程 基础
1.1 thread 模块

# -*- coding: UTF-8 -*-
import thread
import time

# 为线程定义一个函数
def print_time( threadName, delay):
   count = 0
   while count < 5:
      time.sleep(delay)
      count += 1
      print 

你可能感兴趣的:(Timen_Python)