随笔分类 -  多线程之线程锁

并发加锁
摘要:import threading lock = threading.Lock()def th_001(req): lock.acquire() print(req,time.asctime()) lock.release()def test(): pool=[] for i in range(100 阅读全文
posted @ 2019-11-22 16:13 不带R的墨菲特 阅读(119) 评论(0) 推荐(0) 编辑
摘要:1.认识线程和进程: 1.1什么是线程:线程是系统执行任务调度的最小单位,一个进程可以只包含一个线程此时线程也可以理解为进程,当然也可以拥有多个线程,线程之间可以实现资源共享以及通讯什么是进程:系统资源分配的最小单位线程和进程区别:实际上,进程不是同时运行的,对于一个 CPU 而言,某个时间段只能运 阅读全文
posted @ 2019-07-31 12:48 不带R的墨菲特 阅读(233) 评论(3) 推荐(0) 编辑
摘要:package com.webank.ai.fate.serving; import java.text.SimpleDateFormat; import java.util.*; public class MyDemo extends Thread { @Override public void 阅读全文
posted @ 2019-06-26 00:22 不带R的墨菲特 阅读(250) 评论(1) 推荐(0) 编辑
摘要:threadpool 模式线程池调用 阅读全文
posted @ 2019-06-25 18:53 不带R的墨菲特 阅读(256) 评论(0) 推荐(0) 编辑
摘要:#coding=utf-8 import time import base64 import getopt import sys import threading import random import string import os def base64_cal(): str = 'admin' str = str.encode('utf-8') # 加密 ... 阅读全文
posted @ 2019-05-22 23:22 不带R的墨菲特 阅读(291) 评论(0) 推荐(0) 编辑
摘要:# coding=utf-8 import threading import time import string import random class TestTreading(threading.Thread): def __init__(self,func): threading.Thread.__init__(self) self.func ... 阅读全文
posted @ 2019-03-31 15:28 不带R的墨菲特 阅读(306) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示