Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Thread qiuestion

Posted on 2005-04-25
8
Medium Priority
?
240 Views
Last Modified: 2010-04-23
I created thread in the following way

dim x as Threading.Thread = New Threading.Thread(AddressOf mythread)

Then called
x.start


1) What is the state of Thread after it finishes its job?
2) What is the difference betrween sopped state and aborted state?
2) How can restart it again after it finishes (stopped state)?

0
Comment
Question by:f_asmaa
  • 4
  • 4
8 Comments
 
LVL 9

Accepted Solution

by:
cyberdevil67 earned 750 total points
ID: 13864167
Hi f_asmaa,

 1) When it finishes it job, it will be in the stopped state.
 2) Stopped means it stopped on its own, aborted means some other thread, application aborted the thread.
 3) No, once a thread has stopped you need to recreate the thread, if you want to start a thread up again then you should suspend the thread instead of stopping it.

Cheers!
0
 

Author Comment

by:f_asmaa
ID: 13864184
1) What are similarties and dissimilarities between stopped state and aborted state?

2) How can I stop a thread intentionally? (Not by its own when finishes the task but by stop method)

0
 
LVL 9

Expert Comment

by:cyberdevil67
ID: 13864202
1) To let you know how the thread ended, so you can see if it finshied mormally or was aborted... Aborted means it never finished its job.
2) Uset thread.suspend() or thread.Abort()
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:f_asmaa
ID: 13864211
Actually I have a thread x that takes 6 seconds to finish its task

But when I call x.sleep(5000) during the thread execution, the total time is the same not 11 seconds as expected !!! Why?
0
 
LVL 9

Expert Comment

by:cyberdevil67
ID: 13864241
To be honest it should sleep for 5 secs, so can't answer why it is not.
0
 

Author Comment

by:f_asmaa
ID: 13864261
What if I called x.sleep (10000) and there is a CurrentThread.sleep (10000) inside mythread, should be they accumulated together to have a total sleep time of 20 seconds?
0
 
LVL 9

Expert Comment

by:cyberdevil67
ID: 13864270
Yes,

but it would sleep for 10secs then run again then sleep for 10secs.
0
 

Author Comment

by:f_asmaa
ID: 13864290
Are there events for thread x? can I   "Dim WithEvents x As Threading.Thread"?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question