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. Thread Interruption

Thread Interruption

Scheduled Pinned Locked Moved C / C++ / MFC
announcement
6 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.
  • S Offline
    S Offline
    suiram40
    wrote on last edited by
    #1

    I write this 3D editor at http://marius.homeunix.org:8000 I've moved the compilation process in a thread. () The thread has to update the progress bar of the Dialog-Bar and the text in the static and report list box. I'm sending WM_* messages to these windows. Under Win2K work 100% OK but in Win 98 it hangs in the SendMessage (dead lock). Any Ideeas Thanks.

    I 1 Reply Last reply
    0
    • S suiram40

      I write this 3D editor at http://marius.homeunix.org:8000 I've moved the compilation process in a thread. () The thread has to update the progress bar of the Dialog-Bar and the text in the static and report list box. I'm sending WM_* messages to these windows. Under Win2K work 100% OK but in Win 98 it hangs in the SendMessage (dead lock). Any Ideeas Thanks.

      I Offline
      I Offline
      igor1960
      wrote on last edited by
      #2

      Did you try using PostMessage?... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

      S 1 Reply Last reply
      0
      • I igor1960

        Did you try using PostMessage?... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

        S Offline
        S Offline
        suiram40
        wrote on last edited by
        #3

        I have to send text to the static control TCHAR someOutString; _stprntf(someOutString,"Preogress is :%d%%",_percentage); dlgbar.m_static.SendMessage(WM_SETTEXT,0,(LPCTSTR)someOutString); If I do PostMessage I loose the LPARAM ... 'someOutString'. I have installed VC 6 under 98 and I I get hang in user.dll Thx

        I 1 Reply Last reply
        0
        • S suiram40

          I have to send text to the static control TCHAR someOutString; _stprntf(someOutString,"Preogress is :%d%%",_percentage); dlgbar.m_static.SendMessage(WM_SETTEXT,0,(LPCTSTR)someOutString); If I do PostMessage I loose the LPARAM ... 'someOutString'. I have installed VC 6 under 98 and I I get hang in user.dll Thx

          I Offline
          I Offline
          igor1960
          wrote on last edited by
          #4

          >> I have to send text to the static control << So what? You may have different options, e.g: 1. Put your TCHAR someOutString as global variable acessed by both threads; 2. Allocate yours someOutString on sending thread and free on receiving... >> I get hang in user.dll << The reason for hang could be limited message queue on Win98... Regards "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

          S 1 Reply Last reply
          0
          • I igor1960

            >> I have to send text to the static control << So what? You may have different options, e.g: 1. Put your TCHAR someOutString as global variable acessed by both threads; 2. Allocate yours someOutString on sending thread and free on receiving... >> I get hang in user.dll << The reason for hang could be limited message queue on Win98... Regards "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

            S Offline
            S Offline
            suiram40
            wrote on last edited by
            #5

            Opps... It works. I did it and It works fine. Thank you. Anyway I have overmessage there Now I SendMessage() 1-3/sec. and is OK. { static int modul = 0; if(modul++%64 == 0) { UpdateProgressBars() } } Thanks. Igor.

            I 1 Reply Last reply
            0
            • S suiram40

              Opps... It works. I did it and It works fine. Thank you. Anyway I have overmessage there Now I SendMessage() 1-3/sec. and is OK. { static int modul = 0; if(modul++%64 == 0) { UpdateProgressBars() } } Thanks. Igor.

              I Offline
              I Offline
              igor1960
              wrote on last edited by
              #6

              >> Anyway I have overmessage there << OK, that confirms that the reason for a deadlock is limited queue on Win98. Hope 3 seconds is fine, but it's still not be 100% bullet prooof. I don't see any solution other then PostMessage. With PostMessage also you can check on your sending thread that only one WM_SETTEXT is travelling and Post only if nothing is in queue. For example if your string is global and sending thread sets it and receiving empties it --> you will only PostMessage if that global string is empty... Regards "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

              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