Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1027657
  • 博文数量: 288
  • 博客积分: 10306
  • 博客等级: 上将
  • 技术积分: 3182
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-12 17:00
文章分类

全部博文(288)

文章存档

2011年(19)

2010年(38)

2009年(135)

2008年(96)

我的朋友

分类: C/C++

2009-06-11 16:26:11

建了一个链表,使用CMutex对此链表进行互斥访问,然后在两个线程间对此链表进行修改和读取,但是在CWinApp中访问此键表时就会出错,跟踪发现以下代码中获得的m_lstMsg::CMutex中的m_hObject的值(此处为0x0000001)与CMainFrame中实际的值不相同.
Why?

BOOL CInfoBoardSystemV2App::OnIdle(LONG lCount) 
{
// TODO: Add your specialized code here and/or call the base class//
if( HWND h = AfxGetMainWnd()->GetSafeHwnd() )
{
CString strMsg;
if(  ( (CThreadCommunition*) AfxGetMainWnd() )->m_lstMsg.GetHeaderObject(strMsg) )
{
AddMsgToUI( strMsg );
}
}
return CWinApp::OnIdle(lCount);
}
阅读(538) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~