上一页 1 2 3 4 5 6 7 ··· 36 下一页
摘要: 一、UDP协议 1.udp是无连接的,也就是不需要像TCP那样调用 connect(...)函数。正是因为UDP是不需要connect(...),所以UDP是不可靠的。是无应答消息的,即:发出去了就发出去了,也不知道有没有收到。UDP协议也是数据包无序号标识,即:可能先发的数据包,最后收到,也有可能 阅读全文
posted @ 2022-12-20 17:43 repinkply 阅读(258) 评论(0) 推荐(0)
摘要: 1.什么是异步与异步的好处在哪里:异步不会阻塞主进程、主线程的执行。 2.异步和多线程和多进程的区别:1.异步也是一种线程,是一种轻量级的线程,python中称为携程。(与C++11 多线程类似) 2. 异步可以获取函数的返回值,而多线程多进程不能获取返回值,如果想获取返回值必须采用进程池或线程池。 阅读全文
posted @ 2022-12-17 15:05 repinkply 阅读(458) 评论(0) 推荐(0)
摘要: GIL的作用: 1.默认的python解释器 让python 多线程在单一的CPU上工作。 2.只有做的目的是为了线程安全。 阅读全文
posted @ 2022-12-17 12:42 repinkply 阅读(13) 评论(0) 推荐(0)
摘要: 1.没有创建线程 #coding:utf-8 import time import os import multiprocessing import json import random lists = ['C','C++','Qt','Python','Shell','Socket', 'MySQ 阅读全文
posted @ 2022-12-17 12:08 repinkply 阅读(27) 评论(0) 推荐(0)
摘要: #coding:utf-8 import time import os import multiprocessing import json class Work(object): def __init__(self,q): self.q=q def send(self,message): if n 阅读全文
posted @ 2022-12-16 23:00 repinkply 阅读(16) 评论(0) 推荐(0)
摘要: #coding:utf-8 import time import os import multiprocessing def work(count): print(count,',进程id:',os.getpid()) time.sleep(5) if __name__ == '__main__': 阅读全文
posted @ 2022-12-16 20:59 repinkply 阅读(84) 评论(0) 推荐(0)
摘要: 1.没有多进程的版本 os.getpid() # 获取当前进程的pid #coding:utf-8 import time import os def work_a(): for i in range(10): print(i,'a',os.getpid()) time.sleep(1) def w 阅读全文
posted @ 2022-12-16 18:11 repinkply 阅读(28) 评论(0) 推荐(0)
摘要: 1.Linux 文件夹 #include <sys/stat.h> #include <dirent.h> Linux 中一切皆文件,对文件夹的操作本质上也是对文件的操作。 /* Open a directory stream on NAME. Return a DIR stream on the 阅读全文
posted @ 2022-12-16 15:08 repinkply 阅读(129) 评论(0) 推荐(0)
摘要: 线程创建函数: /* Create a new thread, starting with execution of START-ROUTINE getting passed ARG. Creation attributed come from ATTR. The new handle is sto 阅读全文
posted @ 2022-12-16 11:08 repinkply 阅读(52) 评论(0) 推荐(0)
摘要: 1.虚假唤醒 : wait 函数中要有第二个参数(lambda表达式),并且这个 lambda表达式中要正确判断要处理的公共数据是否存在。 2.atomic std::atomic<int> atm; //std::atomic<int> atm2=atm; //std::atomic<int> a 阅读全文
posted @ 2022-12-15 21:46 repinkply 阅读(34) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 36 下一页