|
No, threads will live until:
* They are finished
* They get an exception and exit
* They are aborted
* Threads with .IsBackground = true will exit when the current process ends
(btw. did I miss something?)
But if you create a thread inside an object, it will not stop just because your object dies.
|
|
|
|
|
A recommended way is to use ThreadPool.QueueUserWorkItem to obtain worker threads for your application rather than creating threads directly. Otherwise you should set Thread.IsBackground = true; This will prevent the app from being held open by any threads that are still running.
only two letters away from being an asset
|
|
|
|
|
There's a property called IsBackground on your thread, if this is set to true the thread will be terminated when your program exits. If you want to stop the thread at runtime you'll have to do this from code: The garbage collection won't clean the object it's running from until the thread's stopped (the thread still holds a reference to its parent container), this doesn't necessarily have to be from an IDisposable implementation though: If you stop the thread and there's no references to its parent object anymore the object will be taken care of by the gc.
Standards are great! Everybody should have one!
|
|
|
|
|
The best solution for this is to use a flag in each thread that when set to true allows the thread to run. When this same flag is set to false, the thread exits. Then in the dispose method, set the flag to false and the threads will exit. This is called a co-operative exit which allows the thread to complete its current task before exiting.
Using thread pool threads to complete your work may seem like a good idea, but one must remember that thread pool threads are not executed if the system is busy. In otherwords, if the work being done in a thread is critical, it should not be put in a thread pool thread.
Using thread.abort() to terminate the thread means that if the thread will be interrupted during its execution and told to terminate. If the task being performed by the thread is critical and must be completed, using thread.abort() will at some point interrupt that task and cause problems.
Phil
|
|
|
|
|
I`m looking for a module that would allow me to do speech recognition. I mean, I want to record some sounds, and then I want to be able to record another sound to see to which of the previously recorder sounds this one fits the best.
Could you recommend me a good solution?
Thank you in advance.
|
|
|
|
|
First of all you should read about the basics of speech recognition - it's far mor complicated than what you seem to think. Wikipedia has some information to start with.
Just trying to "compare two sounds" has been tried (without success) 30 years ago, so I strongly doubt that now you'll succeed with such a simplistic approach.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
U dont understand. I wrote clearly that I`m looking for such module. I don`t intend to write myself.
|
|
|
|
|
Yoyosch wrote: U dont understand. I wrote clearly that I`m looking for such module. I don`t intend to write myself.
You don't understand. It is "wrote clearly" in the forum guidelines that no one will write code for you. You will be hard-pressed to find what you are looking for. I am almost 100% confident that you will have an even harder time finding what you are looking for, free of charge. Learn to use google, you are going to need it to do the research. Good luck
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hi all
I have an inherited control from standard textbox control. In this textbox control i set some default property value to new one.
<br />
this.BackColor = System.Drawing.Color.Red;<br />
<br />
In this case when user place my derived control to a form designer generate in InitializeComponent() this rows
<br />
<br />
((System.ComponentModel.ISupportInitialize)(this.derivedTextBox)).BeginInit();<br />
....<br />
this.derivedTextBox.BackColor = System.Drawing.Color.Red;<br />
<br />
<br />
As a result when form are created DerivedTextBox.BackColor property invoked 2 times. First -
when control created and Second - in the InitializeComponent() method of form where placed.
I know that in this example it dosn't matter but actually i have other base control (not text box), what can add to oneself buttons [for examp: this.Buttons.Add("MyNewButton") - base control by default not have this button, but in derived it shoul be], and since what every time when i want to add button to this control one add two times)
And now i have question, is exists an event what invoked only when control added to a form???
Or where in code i should write initialization control code so as this code will only generated in InitializeComponent() method of form and not to bee invoked when control are created????
THANK.
|
|
|
|
|
if you have a constructor in your derived class then inherit the base class constructor, like:
MyTextBox(): base()
{
}
i think you should use ControlAdded Event
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
How to store files(.doc files,.zip files) in a database and how to retrieve them
|
|
|
|
|
Are you using Oracle or SQLServer database? The concepts are the same for both, but the terminology is a little different.
If you are talking about Microsoft SQL Server then you will be looking at storing and retrieving a BLOB (Binary Large Objects). If you look up Microsoft SQL Server and BLOB you should be able to find all the resources you need to get started.
Try this to start with:
http://support.microsoft.com/kb/309158[^]
Hope this helps
Aaron
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
very thanks for reply me
|
|
|
|
|
IO.Directory.GetFiles("C:\\Windows"); will get me all the files in the windows directory, but is there a way to get all the absolute path names to these files that IO.Directory.GetFiles(path) finds??
|
|
|
|
|
Have a look at the Path Class[^] It has several functions which can help you.
|
|
|
|
|
hi friends.
I have converted a doc or image file to byte code by this code.
-------------------
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
int length = (int)fs.Length;
byte[] content = new byte[length];
fs.Read(content, 0, length);
--------------------
Now i want to convert this "content" i.e array of byte to actual file.
at the time of conversion in which object should i store the output (because i don't know the type of file i had converted to byte code).
How to do this.
(basically i m sending a file(image,doc,txt etc) from one machine to another remotely).
Hope you understand what i want to do here.
Thanks lot.
|
|
|
|
|
Just use Write method instead of Read and pass the byte array you have to it.
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Write);
int length = content.Length;;
fs.Write(content, 0, length);
|
|
|
|
|
and how to convert it back into a file??
|
|
|
|
|
It will be a file. Just don't forget to close the stream when you've done writing to it. Also, you might want to create the file first if it doesn't exists
|
|
|
|
|
I think your question related to knowing what type of file to save the byte stream as on your target machine? mr. Dalakishvili has told you how to save ti to your target path, all you need do is keep the same extension and it should work fine.
|
|
|
|
|
-------------------
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
int length = (int)fs.Length;
byte[] content = new byte[length];
fs.Read(content, 0, length);
--------------------
ah, a long way to convert a file into byte[],
try
byte[] mybytes = File.ReadAllBytes(filePath);
to write byte(back to file)
File.WriteAllBytes(filePath, mybytes);
hope this will help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi
Can someone please help me... It's seem like there is not a single way to get the column size from a dataset, table, datarow from SQL/Oracle in .Net using C# or VB
Thanks in advance
|
|
|
|
|
|
how to create folder in run time.
hai when i register my details create a folder in my name using .net with c#.if u know the code replay me.
modified on Wednesday, February 27, 2008 6:17 AM
|
|
|
|
|