473,387 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Component/Control using threads how can I do........

Hi,
I want to develop a component or a control(no UI, just like a timer or
something)... This component will have a thread running from it's
constructor or from a start function until a stop function or the end of the
application. What I want to know is the following : How can I know when the
application stops (in case I forgot to call the stop function) so I can stop
my thread quickly? I'd use dispose, but it can be called whenever the GC
decides to and it's not always at Application end, it could be seconds or
worse, minutes later...

How should I do? Is there a sandard for this kind of behavior?

thanks

ThunderMusic
Sep 15 '06 #1
1 1018
Hi,
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:eX**************@TK2MSFTNGP06.phx.gbl...
Hi,
I want to develop a component or a control(no UI, just like a timer or
something)... This component will have a thread running from it's
constructor or from a start function until a stop function or the end of
the application. What I want to know is the following : How can I know
when the application stops (in case I forgot to call the stop function) so
I can stop my thread quickly? I'd use dispose, but it can be called
whenever the GC decides to and it's not always at Application end, it
could be seconds or worse, minutes later...
Minutes later than the application ends? don't think so :)

IMO if you mark your thread with IsBackground = true you are safe.

Note that this does not assure you a "clean" termination, if you want to do
some cleaning you better implement the IDisposable pattern.

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Sep 15 '06 #2

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

Similar topics

12
by: Chien Lau | last post by:
I had a situation occur today that's happened a number of times before and I'd like to get your take on it: Imagine... You're developing a WinForms app for a client that includes the use charts....
6
by: TnCoder | last post by:
Hi; I just moved from vb 6.0 to vb.net. I am trying to add MS Calendar control to my toolbox. After the control is added, it is not enabled. Is there dll I have to add? Can anyone who could give...
3
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has...
4
by: Grigs | last post by:
Hello, I have a fairly simple class that I created and it works great. Basically it remembers a certain amount of strings. When a new one comes in the oldest drops off. The problem is, when I...
5
by: Geoff Kell (Lockdesign Ltd) | last post by:
I have just started using VB.Net and I am developing a class to provide data to clients from an IBM-MQ queue. I have developed a class which connects to the queue and issues a read. When a...
2
by: talam | last post by:
We had an old application developed using Visual Basic Language. We are trying to replace that application with .net 2005, C# Language. In the old application, we had a file attachment component....
9
by: john doe | last post by:
I have a question about BeginInvoke method found on the Control class. To quote the docs: "Executes the specified delegate asynchronously with the specified arguments, on the thread that the...
1
by: ThunderMusic | last post by:
Hi, I want to develop a component or a control(no UI, just like a timer or something)... This component will have a thread running from it's constructor or from a start function until a stop...
122
by: Edward Diener No Spam | last post by:
The definition of a component model I use below is a class which allows properties, methods, and events in a structured way which can be recognized, usually through some form of introspection...
0
by: bharathreddy | last post by:
In .Net COM+ components are referred to as serviced components, Namespace: System.EnterpriseServices; Advantage of Serviced Components: object pooling, database connection pooling,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.