Dear all,
I have an application, besides the main thread, there is another
child thread, say, ChildThread, running.
I met a problem when I open a SaveFileDialog.ShowDialog, after
SaveFileDialog close, the ChildThread was stopped. So I want to
restart the ChildThread, then I call,
ChildThread=new Thread(new ThreadStart(ChildProcess));
ChildThread.Start();
But the ThreadState of ChildThread is unstarted although I called
ChildThread.Start(), so what is the problem? How can I restart the
ChildThread?
Jianren 2 1849
Hi,
All UI actions should be done from the main thread, you can stop a thread
with no problem but the code ChildThread=new Thread(new ThreadStart(ChildProcess)); ChildThread.Start();
create a new thread, not restart the other, now you have three threads :
1- the main thread.
2- the stopped thread
3- the new thread.
To restart a thread you use Thead.Resume ( previously you did a
Thread.Suspend ).
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Jianren" <ji*****@ile.osaka-u.ac.jp> wrote in message
news:24**************************@posting.google.c om... Dear all, I have an application, besides the main thread, there is another child thread, say, ChildThread, running. I met a problem when I open a SaveFileDialog.ShowDialog, after SaveFileDialog close, the ChildThread was stopped. So I want to restart the ChildThread, then I call,
ChildThread=new Thread(new ThreadStart(ChildProcess)); ChildThread.Start();
But the ThreadState of ChildThread is unstarted although I called ChildThread.Start(), so what is the problem? How can I restart the ChildThread?
Jianren
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:e0**************@TK2MSFTNGP09.phx.gbl... Hi,
To restart a thread you use Thead.Resume ( previously you did a Thread.Suspend ).
Ignacio ,
This looks like a real bad advise:
1.Thread.Suspend and his cousin Resume are THE source of deadlocks.
2. Both Resume and Suspend are deprecated in v2.0.
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ahsan |
last post by:
I have created some background threads so that when the application aborts
all the threads should be automatically aborted. But the problem is that when
I make a thread background thread I am...
|
by: emr |
last post by:
Hi there, here is the situation:
private void btnStart_Click(object sender, System.EventArgs e)
{
if(btnStart.Text=="START")
{
|
by: benmorganpowell |
last post by:
I have a small windows service which connects to a POP3 server at
defined intervals, scans the available messages, extracts the required
information and inserts the data into a SQL database. I am...
|
by: Nathan |
last post by:
I'm trying to start a thread from the Application_Start event in
Global.asax. The thread is supposed to run some code, store the time it
ran in the database and then sleep for 24 hours.
My code...
|
by: Microsoft |
last post by:
I'm trying to use threading for the first time and can't get it to work.
(VB)
In the page I've got:
Sub Page_Load( sender As Object, e As EventArgs )
dim o as new Example.Test...
|
by: Nick |
last post by:
Hi there,
This one is really doing my head in, I am attempting to start a thread
using the following code,
--------------------
Public Sub start()
cTrdImportThread = New...
|
by: brian_harris |
last post by:
I am tring to start a thread where I am passing info into thread. According
to MS documentation I must do this by creating a class for that thread. I
have done this but am getting a compiler...
|
by: va_acharya |
last post by:
I have a timer control on a windows form. From the tick event(t1_tick) i
am creating an object of a thread which is calling a function test(),
which is an empty function void test(){}. Timer...
|
by: Creativ |
last post by:
Why does Thread class not support IDisposable? It's creating quite
some problem. Namely, it can exhaust the resource and you have not
control over it.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
| |