#include <Windows.h>
#include <stdio.h>
VOID NTAPI SimpleCallback(PTP_CALLBACK_INSTANCE Instance, PVOID Context)
{
char* str = (char*)Context;
printf("Hello %s\n", str);
}
VOID NTAPI WorkCallback(PTP_CALLBACK_INSTANCE Instance, PVOID Context, PTP_WORK Work)
{
char* str = (char*)Context;
printf("Hello %s\n", str);
}
int main(int argc, char* argv[])
{
char str[] = "test";
//if (TrySubmitThreadpoolCallback(SimpleCallback, str, NULL))
//{
// printf("执行成功!\n");
//}
PTP_WORK workItem = CreateThreadpoolWork(WorkCallback, str, NULL);
SubmitThreadpoolWork(workItem);
SubmitThreadpoolWork(workItem);
SubmitThreadpoolWork(workItem);
SubmitThreadpoolWork(workItem);
SubmitThreadpoolWork(workItem);
SubmitThreadpoolWork(workItem);
CloseThreadpoolWork(workItem);
getchar();
return 0;
}
Windows线程池(一)-基本工作项
最新推荐文章于 2022-08-13 11:24:33 发布
关键词由CSDN通过智能技术生成