Making an Application Hang.
-
You want to construct or Destruct the application ? :-D
-
Hari_16 wrote:
I have a dialog based application and are there any general scenarios where i can make the application hang
There are quite a lot, I suppose. :)
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] -
Well it is difficult to point some, until and unless knowing your intentions :^)
Величие не Бога может быть недооценена.
-
Well it is difficult to point some, until and unless knowing your intentions :^)
Величие не Бога может быть недооценена.
-
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
-
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....
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 :)
Величие не Бога может быть недооценена.
-
Hi All, I have a dialog based application and are there any general scenarios where i can make the application hang. Thanks, Hari
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
-
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
-
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
-
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....
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
-
Hi All, I have a dialog based application and are there any general scenarios where i can make the application hang. Thanks, Hari
-
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