CFanatic

Go Back   CFanatic > Programming > MFC Programming

Join CFanatic Forum Now

Visual Studio hangs during Debugging a thread: topic posted under MFC Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2006, 12:30 PM
Junior Member
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
PfisterHarald is on a distinguished road
| More
Visual Studio hangs during Debugging a thread:

VC++ 6.0 Enterprise edition
WindowsXP SP2

A Simple test project was generated with MFC app wizard (dialog based).

Code:
////////////////////////////////////////////
// The following code was added to CTestDlg.cpp:
void CTestDlg::OnOK() {
        // Start test
        m_pThread = AfxBeginThread(TestThread, &tinf_OnOkThread);
        m_hThread = m_pThread->m_hThread;    // Save Handle to ThreadFunction
        //CDialog::OnOK();
}

UINT CTestDlg::TestThread(LPVOID lpParam) {
int _i;
        for (_i = 0; _i <= 10000000; _i++) {
                _i = _i;
        }       // << BREAKPOINT is set here
        return(0);

}

////////////////////////////////////////////
// The following code was added to CTestDlg.h:
typedef struct STRUCT_TINFTEST {
        bool bStop;
        bool bRuns;

} struct_tinfTest;

public:
        static UINT TestThread(LPVOID lpParam);
protected:
        struct_tinfTest tinf_OnOkThread;
        CWinThread *m_pThread;          // pointer to thread-function
        HANDLE  m_hThread;              // handle to thread-function
        virtual void OnOK();
After starting the program and pressing the Ok button the thread is started.
The execution stops at the BREAKPOINT. Continue with F5 the execution stops
again at the BREAKPOINT. Doing this about 300 times (or less if more
instructions are in the for loop) Visual Studio hangs for about 30 seconds.
In the toolbar "Debug" the commands "Restart" and "Stop Debugging" are
enabled as shown when the Breakpoint is reached and the user may continue.
The window title shows "test - Microsoft Visual C++ [run]" for the first 15
seconds and "test - Microsoft Visual C++ [break]" for the next 15 seconds.
During these times VS doesn't react on anything, even the complete system
hangs. A change to another application is not possible (or extremely time
intensive). Opening the Task Manager is not possible (or uses too much time).
The options are to wait the 30 seconds or using Ctrl-Alt-Del and choose
"Logout" (results in a dialog to terminate MSDEV that doesn't react).

Is there anyone that knows the problem and a solution?
Is it already a problem of VS or a system bug?

Thanks for answer
Pfister Harald
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Visual studio 2008 and error C2664 C2440 soong C++ Programming 2 10-04-2008 01:29 AM
Thread Prog in C language (OS independent) kumars C Programming 11 10-03-2008 09:30 AM
Refactoring in VC++/Visual Studio AB MFC Programming 2 06-27-2008 06:01 AM
I have Win XP SP1 but I need Visual C++ 2005 CODINGMASTER C++ Programming 4 08-20-2007 10:47 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 03:20 PM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board