三线程同步的问题!我认为是巨难的!

xiangshifu99 2003-08-26 08:08:00
三线程同步的问题!我认为是巨难的!

我的三个线程关系如下:

Function A()
{
return x;
}

Function B()
{
创建运行 Function A(); 并需要立即返回,不能等待!
}

Function C()
{
创建运行 Function B();

等待 Function A() 执行完毕后 以Function A()的返回值做为依据进行下一步操作!

}
...全文
21 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ayanamiwww 2003-08-27
  • 打赏
  • 举报
回复
HANDLE m_hFunAEventKill;
Function a()
{
m_hFunAEventKill= CreateEvent(NULL, TRUE, FALSE, NULL);
//do your work
SetEvent(m_hFunAEventKill);
return x;
}
Function C()
{
创建运行 Function B();
WaitForSingleObject(m_hFunAEventKill);//等待 Function A()
//do your work
}

tanyaliji 2003-08-27
  • 打赏
  • 举报
回复
m_hFunAEventKill= CreateEvent(NULL, TRUE, FALSE, NULL);
//do your work
SetEvent(m_hFunAEventKill);
return x;
whoo 2003-08-27
  • 打赏
  • 举报
回复
B
{
return CreateThread(A);
}

C
{
HANDLE h=B();
WaitForSingleObject(h);
GetExitCodeThread(h);
}
UDX协议 2003-08-27
  • 打赏
  • 举报
回复
easy.
20 .
.....

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧