Click here to Skip to main content
15,914,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Thread Name Pin
Rajkumar R8-May-08 20:18
Rajkumar R8-May-08 20:18 
GeneralRe: Thread Name Pin
ForNow8-May-08 20:46
ForNow8-May-08 20:46 
GeneralRe: Thread Name Pin
Rajkumar R8-May-08 22:07
Rajkumar R8-May-08 22:07 
GeneralRe: Thread Name Pin
ForNow9-May-08 0:52
ForNow9-May-08 0:52 
QuestionFtpCommand Function? Pin
monsieur_jj8-May-08 15:45
monsieur_jj8-May-08 15:45 
AnswerRe: FtpCommand Function? Pin
Randor 8-May-08 16:37
professional Randor 8-May-08 16:37 
GeneralRe: FtpCommand Function? Pin
ShilpiP8-May-08 19:30
ShilpiP8-May-08 19:30 
GeneralRe: FtpCommand Function? Pin
Randor 9-May-08 3:56
professional Randor 9-May-08 3:56 
Hello Shilpi,

It is very difficult to say what is wrong without looking at the code. To eliminate the possibility of deadlocks and race conditions I always recommend using PostThreadMessage/PostMessage for communication between application dialogs and threads.

If you are creating a very large number of threads you may want to research STACK_SIZE_PARAM_IS_A_RESERVATION. When you use CreateThread it defaults to reserving 1 MB of stack space each thread. This can limit the amount of threads available to your application. I always reduce the stack size to 512 kilobytes for low-duty worker threads. For example:

CWinThread *pTmpThread = NULL;
...
...
if (NULL != pTmpThread)
{
	ASSERT_VALID(pTmpThread);
	if (!pTmpThread->CreateThread(CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION ,524288,NULL))
	{
		delete pTmpThread;
		*pOldThread=NULL;
		return;
	}
	pTmpThread->m_bAutoDelete = TRUE;
	VERIFY(pTmpThread->SetThreadPriority(THREAD_PRIORITY_NORMAL));
	pTmpThread->ResumeThread();
	PostThreadMessage(pTmpThread->m_nThreadID,WM_THREAD_START,0,0);
}


Once again it is very difficult to say what is the problem without having a look at your code. If you continue to have this same problem I would suggest creating a new post here on the C++ forum and maybe add some source code.

Best Wishes,
-David Delaune
GeneralRe: FtpCommand Function? Pin
ShilpiP11-May-08 19:24
ShilpiP11-May-08 19:24 
GeneralRe: FtpCommand Function? Pin
monsieur_jj8-May-08 21:58
monsieur_jj8-May-08 21:58 
GeneralRe: FtpCommand Function? Pin
monsieur_jj8-May-08 22:10
monsieur_jj8-May-08 22:10 
GeneralRe: FtpCommand Function? Pin
Randor 9-May-08 3:37
professional Randor 9-May-08 3:37 
GeneralRe: FtpCommand Function? Pin
monsieur_jj11-May-08 19:22
monsieur_jj11-May-08 19:22 
Questionwhy i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
xqhrs2328-May-08 15:42
xqhrs2328-May-08 15:42 
AnswerRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
David Crow8-May-08 16:21
David Crow8-May-08 16:21 
QuestionRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
Rajesh R Subramanian8-May-08 19:19
professionalRajesh R Subramanian8-May-08 19:19 
AnswerRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
Nitheesh George8-May-08 19:53
Nitheesh George8-May-08 19:53 
AnswerRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
Hamid_RT8-May-08 19:56
Hamid_RT8-May-08 19:56 
AnswerRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
Dan8-May-08 20:19
Dan8-May-08 20:19 
GeneralRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
xqhrs2328-May-08 21:12
xqhrs2328-May-08 21:12 
GeneralRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
Mark Salsbery9-May-08 6:51
Mark Salsbery9-May-08 6:51 
GeneralRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
xqhrs23210-May-08 16:12
xqhrs23210-May-08 16:12 
GeneralRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. [modified] Pin
Mark Salsbery10-May-08 17:07
Mark Salsbery10-May-08 17:07 
GeneralRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
xqhrs23213-May-08 3:28
xqhrs23213-May-08 3:28 
GeneralRe: why i cannot close a dialog? the close operation by a button which sendmessage the WM_CLOSE message. Pin
Mark Salsbery13-May-08 4:45
Mark Salsbery13-May-08 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.