Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with multi-threaded app

Help with multi-threaded app

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++lounge
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dean Goodman
    wrote on last edited by
    #1

    I've been working on a small multi-threaded app for a while, and I've ironed out all of the bugs except for one. I'm not very proficient with threading in general, so for all I know, this could be a simple problem. The app actually consists of two worker threads and the main GUI thread, but the problem lies within the GUI thread. As a quick note, the worker threads do not touch the GUI thread, so I know that's not what is causing the trouble. I have a simple Browse button that brings up a CFileDialog to allow the user to pick an input file, which works as it is supposed to. There are several other fields of data that the user must enter (basically data that is relevant to the file and how it will be processed). After entering the data, the user then pushes another button that will add this info to a CListCtrl and an internal list that is used for processing the file(s) later. I also have an 'Options' button that brings up another dialog where the user sets various program parameters. Here is where the problem arises: If the user clicks the 'Options' button before they save information to the list of files to be processed, the dialog comes up without any problems. So long as no information has been added to the CListCtrl, the 'Options' dialog works like it supposed to. As soon as any info is added to the CListCtrl, however, the program will lock upon the user clicking the 'Options' button. I know from tracing through the code that the program locks upon the call

    hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, pParentWnd->GetSafeHwnd(), AfxDlgProc);

    The above statement is part of DLGCORE.CPP, and is called upon trying to open the 'Options' dialog. Could someone please enlighten me as to what I am doing wrong? Any ideas would be appreciated. --Dean

    T 1 Reply Last reply
    0
    • D Dean Goodman

      I've been working on a small multi-threaded app for a while, and I've ironed out all of the bugs except for one. I'm not very proficient with threading in general, so for all I know, this could be a simple problem. The app actually consists of two worker threads and the main GUI thread, but the problem lies within the GUI thread. As a quick note, the worker threads do not touch the GUI thread, so I know that's not what is causing the trouble. I have a simple Browse button that brings up a CFileDialog to allow the user to pick an input file, which works as it is supposed to. There are several other fields of data that the user must enter (basically data that is relevant to the file and how it will be processed). After entering the data, the user then pushes another button that will add this info to a CListCtrl and an internal list that is used for processing the file(s) later. I also have an 'Options' button that brings up another dialog where the user sets various program parameters. Here is where the problem arises: If the user clicks the 'Options' button before they save information to the list of files to be processed, the dialog comes up without any problems. So long as no information has been added to the CListCtrl, the 'Options' dialog works like it supposed to. As soon as any info is added to the CListCtrl, however, the program will lock upon the user clicking the 'Options' button. I know from tracing through the code that the program locks upon the call

      hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, pParentWnd->GetSafeHwnd(), AfxDlgProc);

      The above statement is part of DLGCORE.CPP, and is called upon trying to open the 'Options' dialog. Could someone please enlighten me as to what I am doing wrong? Any ideas would be appreciated. --Dean

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Try Debug|Break when application hangs. You should be able to have a look at the other threads' stacks - this information may be helpful. Tomasz Sowinski -- http://www.shooltz.com

      D 1 Reply Last reply
      0
      • T Tomasz Sowinski

        Try Debug|Break when application hangs. You should be able to have a look at the other threads' stacks - this information may be helpful. Tomasz Sowinski -- http://www.shooltz.com

        D Offline
        D Offline
        Dean Goodman
        wrote on last edited by
        #3

        The other threads have nothing to do with the GUI though. In fact, when the app hangs, the other (worker threads) haven't even been started. --Dean

        T 1 Reply Last reply
        0
        • D Dean Goodman

          The other threads have nothing to do with the GUI though. In fact, when the app hangs, the other (worker threads) haven't even been started. --Dean

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          But what's on the stack when you Debug|Break? A call to ::CreateDialogIndirect or something else? Tomasz Sowinski -- http://www.shooltz.com

          D 1 Reply Last reply
          0
          • T Tomasz Sowinski

            But what's on the stack when you Debug|Break? A call to ::CreateDialogIndirect or something else? Tomasz Sowinski -- http://www.shooltz.com

            D Offline
            D Offline
            Dean Goodman
            wrote on last edited by
            #5

            Funny -- this has been a bug for a very long time now, and now that I'm trying to reproduce it so I can see what's on the stack, everything works perfectly. You gotta love it...

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups