
WIN32
cosocc
这个作者很懒,什么都没留下…
展开
-
多线程临界区
#include <stdio.h> #include <Windows.h> #include <process.h> BOOL g_bContinue = TRUE; int g_nCount1 = 0; int g_nCount2 = 0; CRITICAL_SECTION g_cs;//对存在同步问题的代码段使用临界区对象 UINT _stdcall ThreadFunc(LPVOID) { while (g_bContinue) { ::EnterCri原创 2021-03-01 03:15:50 · 124 阅读 · 0 评论 -
简易的多线程优先级
#include <stdio.h> #include <Windows.h> DWORD WINAPI ThreadIdle(LPVOID lpParam) { int i = 0; while (i++<10) { printf_s("Idle Thread is running \n"); Sleep(100); } return 0; } DWORD WINAPI ThreadNormal(LPVOID lpParam) { int i = 0;原创 2021-03-01 02:57:24 · 106 阅读 · 0 评论