C++
Jon__Wang
蜗牛背着那重重的壳啊,一步一步的往上爬...
展开
-
C++ Windows下使用WinAPI创建线程的方法
1,包含头文件#include <windows.h> 2. 创建线程// 构造函数或主函数中:HANDLE hThread = CreateThread(NULL, 0, ThreadProcessFunc, NULL, 0, NULL);// 函数原型:HANDLECreateThread(LPSECURITY_ATTRIBUTESlpThreadAttr...原创 2020-02-13 11:53:03 · 1560 阅读 · 0 评论 -
不使用sleep,使线程暂停(等待)一定的时间的方法(C++/C#)
正式程序中应该尽量避免使用sleep,至于为啥,请自行百度.C#: Monitor.Wait的方法和WaitOne方法Monitor.Wait:object obj = new object();// 线程内:while (true){ lock (obj) { Monitor.Wait(obj, 1000);// 释放锁,并等待1000毫秒 ...原创 2019-11-20 10:39:31 · 2235 阅读 · 0 评论