473,775 Members | 2,362 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

threaded forms, deadlocks on exit

- realtime application has multiple forms. each form is created on a new
(gui) thread. this was supposedly for efficiency reasons, i am told. this
was done before i took this project. it was done by some java people. they
claim this is the way it is done in java.

- project worked fine in .net 1.1

- on upgrade to .net 2.0, the app does not terminate. i have to debug it
using windbg, as the deadlocks get quite bad. usually the dealocks are
caused by DLL unloads. (LdrLock or similar).

-I've even tried Thread.Abort, ExitThread, Exit etc. no luck.

- is there anything i can do to get it to exit easily.

Oct 20 '07 #1
2 1426

"anon" <me@privacy.net wrote in message news:SPtSi.830$ Y23.660@trndny0 4...
>- realtime application has multiple forms. each form is created on a new
(gui) thread. this was supposedly for efficiency reasons, i am told. this
was done before i took this project. it was done by some java people. they
claim this is the way it is done in java.

- project worked fine in .net 1.1

- on upgrade to .net 2.0, the app does not terminate. i have to debug it
using windbg, as the deadlocks get quite bad. usually the dealocks are
caused by DLL unloads. (LdrLock or similar).

-I've even tried Thread.Abort, ExitThread, Exit etc. no luck.

- is there anything i can do to get it to exit easily.
Yeah, it's called rewrite the program so that it works.

Oct 21 '07 #2
I've used this same pattern before: creating a number of threads, and then
having a window on each thread. I've generally done it for splash screens,
but it works fine for other uses. Nothing wrong with the general pattern at
all.

The big question is where is the thread lifetime management being done?

My guess is that you're going to want to:
- On the "main" thread, signal all the forms to shutdown. May need to be a
custom windows message.
- Wait for each control thread to terminate
- Terminate the main thread.

I've also had some luck, from a "quick and dirty" perspective, in setting
the Threads to be background threads. This has eliminated a number of
shutdown issues related to rogue threads. It's an ugly hack, and spending
the time to fix the bugs is probably the better bet.

--
Chris Mullins

"anon" <me@privacy.net wrote in message news:SPtSi.830$ Y23.660@trndny0 4...
>- realtime application has multiple forms. each form is created on a new
(gui) thread. this was supposedly for efficiency reasons, i am told. this
was done before i took this project. it was done by some java people. they
claim this is the way it is done in java.

- project worked fine in .net 1.1

- on upgrade to .net 2.0, the app does not terminate. i have to debug it
using windbg, as the deadlocks get quite bad. usually the dealocks are
caused by DLL unloads. (LdrLock or similar).

-I've even tried Thread.Abort, ExitThread, Exit etc. no luck.

- is there anything i can do to get it to exit easily.

Oct 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1894
by: Gordon Messmer | last post by:
I've been working on a threaded daemon application to filter email. The source for the program is here: http://phantom.dragonsdawn.net/~gordon/courier-patches/courier-pythonfilter/ The daemon loads individual filters as modules and hands the names of the message and control files to each module in turn for processing. One of the modules (filters/dialback.py) checks the address of the sender, connects to the MX servers for the senders...
3
5264
by: Anand Pillai | last post by:
This is for folks who are familiar with asynchronous event handling in Python using the asyncore module. If you have ever used the asyncore module, you will realize that it's event loop does not have a programmable exit condition. It keeps looping till the channels in its socket map (a dictionary) are closed and don't have any pending reads/writes. If you are using Python threads in your application, by using either the threading or...
2
1673
by: Mike Rovner | last post by:
Hello, Please advise on multi-threaded list *append*: import time, random, thread aList = def main(): for i in range(10):
0
1100
by: Derek Thomson | last post by:
Hi, I frequently have to debug some fairly tricky Python multi-threaded code, and I need some help using the debugger to help me diagnose the problems when they occur. Yes, I know that the best option with threaded code that is problematic is to rewrite it, but that's not really an option that I have (right now). What would really help me is to be able to see a list of all the currently active threads, and the Python stack trace for...
5
1706
by: Rob Durant | last post by:
Hi, I have a multi-threaded application (have also tried as service - same behaviour) that runs fine on XP, but not on 2003. Symptoms are: Threads are started normally, locks acquired and released as needed, runs fine for some time, then stops - Visual Studio detects no exceptions, and I have placed break points on all the handling code to catch them. No errors / failures are logged, but child threads have all exited, and I am left...
5
23357
by: Parahat Melayev | last post by:
I am trying to writa a multi-client & multi-threaded TCP server. There is a thread pool. Each thread in the pool will handle requests of multiple clients. But here I have a problem. I find a solution but it is not how it must be... i think. When threads working without sleep(1) I can't get response from server but when I put sleep(1) in thread function as you will see in code, everything works fine and server can make echo nearly for...
3
2605
by: Rsrany | last post by:
I've been working on a few gtk applications and need to tie a hot key catcher into a thread. I am currently finding threaded user32.GetMessageA do not work. I have included two programs: 1) a non-threaded version that works 2) a threaded version that doesnt work. Any constructive suggestions would be helpful
0
1168
by: JeffJones176 | last post by:
Hello All: I am very new to multi-threaded programming and have a need (I think) to write an application that uses multi-threaded pages. My scenario follows: My business has multiple databases, multiple websites, like a franchised business, and multiple branches that go to each website (22 branches for one website, 2 for another, etc.).
2
1929
by: EvilOldGit | last post by:
In the stuff I've read about multi threaded singleton it seems to assume that creating the Lock is atomic, and various sources, including Sutter go for RAII. { Lock l; if ( ! inst ).... } But I don't see how to do this with a real O/S API. The ones I've looked at have a two step process to making a lock, they require a "Create" function and a "Start Locking" function.
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9915
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.