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. Making an Application Hang.

Making an Application Hang.

Scheduled Pinned Locked Moved C / C++ / MFC
lounge
15 Posts 6 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.
  • H Hari_16

    Can u name some of them.....

    A Offline
    A Offline
    Adam Roderick J
    wrote on last edited by
    #6

    Well it is difficult to point some, until and unless knowing your intentions :^)

    Величие не Бога может быть недооценена.

    H 1 Reply Last reply
    0
    • A Adam Roderick J

      Well it is difficult to point some, until and unless knowing your intentions :^)

      Величие не Бога может быть недооценена.

      H Offline
      H Offline
      Hari_16
      wrote on last edited by
      #7

      Honestly .. no specific intentions just had some crashes and fixed it .. so was thinking of ways to hang an application . In my project i use multithreading and critical section to synchronise them....

      A R 2 Replies Last reply
      0
      • H Hari_16

        Can u name some of them.....

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #8

        You may put an infinite loop somewhere. Your thread may wait for a dead synchronization object. A blocking I/O function call... [added] You may even lauch Eclipse, for the purpose [/added] There are quite a lot ways for you, to make it happen... :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        modified on Tuesday, November 3, 2009 5:28 AM

        In testa che avete, signor di Ceprano?

        H 1 Reply Last reply
        0
        • H Hari_16

          Honestly .. no specific intentions just had some crashes and fixed it .. so was thinking of ways to hang an application . In my project i use multithreading and critical section to synchronise them....

          A Offline
          A Offline
          Adam Roderick J
          wrote on last edited by
          #9

          Multithreading and synchronization is not more than enough for a dead lock. :) Just check the the various conditions of dead lock. have to home work on your operating system knowledge Just refer Modern operating systems from Andrew S. Tanenbaum. I love this book :)

          Величие не Бога может быть недооценена.

          1 Reply Last reply
          0
          • H Hari_16

            Hi All, I have a dialog based application and are there any general scenarios where i can make the application hang. Thanks, Hari

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #10

            By "hang", I assume that an application becomes unresponsive? If that's it, then blocking the UI thread would be almost the only reason why it happens. For example, if there's a lengthy calculation of some sort, like parsing a huge file, then that should be done on a separate thread.

            “Follow your bliss.” – Joseph Campbell

            H 1 Reply Last reply
            0
            • CPalliniC CPallini

              You may put an infinite loop somewhere. Your thread may wait for a dead synchronization object. A blocking I/O function call... [added] You may even lauch Eclipse, for the purpose [/added] There are quite a lot ways for you, to make it happen... :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              modified on Tuesday, November 3, 2009 5:28 AM

              H Offline
              H Offline
              Hari_16
              wrote on last edited by
              #11

              Thks a lot ....

              1 Reply Last reply
              0
              • H Hari_16

                Honestly .. no specific intentions just had some crashes and fixed it .. so was thinking of ways to hang an application . In my project i use multithreading and critical section to synchronise them....

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #12

                If you do not use a critical section, that won't make your application "hang". You'll possibly lose out on data corruption due to race condition, but the threads will continue to execute and at worst you'll take a nasty crash (like an access fault). But a using or not using a critical section won't have anything to do with a "hang", unless a thread is being a dog and locking a resource (for a long time) that the UI thread is waiting for. But that boils down to my other reply that I've posted to your original query.

                “Follow your bliss.” – Joseph Campbell

                1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  By "hang", I assume that an application becomes unresponsive? If that's it, then blocking the UI thread would be almost the only reason why it happens. For example, if there's a lengthy calculation of some sort, like parsing a huge file, then that should be done on a separate thread.

                  “Follow your bliss.” – Joseph Campbell

                  H Offline
                  H Offline
                  Hari_16
                  wrote on last edited by
                  #13

                  Thks for ur reply

                  1 Reply Last reply
                  0
                  • H Hari_16

                    Hi All, I have a dialog based application and are there any general scenarios where i can make the application hang. Thanks, Hari

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #14

                    Hari_16 wrote:

                    where i can make the application hang

                    I am not sure why you want to hang your own thread but this should work:SuspendThread(GetCurrentThread());
                    Best Wishes, -David Delaune

                    H 1 Reply Last reply
                    0
                    • L Lost User

                      Hari_16 wrote:

                      where i can make the application hang

                      I am not sure why you want to hang your own thread but this should work:SuspendThread(GetCurrentThread());
                      Best Wishes, -David Delaune

                      H Offline
                      H Offline
                      Hari_16
                      wrote on last edited by
                      #15

                      Thks it worked ......

                      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