| Author |
thread join question
|
Rachel Glenn
Ranch Hand
Joined: Oct 24, 2012
Posts: 95
|
|
Refer to the code below...
I know nothing is truly 'guaranteed' in threading, but in the code example below, is it correct to say that the string "end concurrency" will NEVER be printed before mt1 and mt2 have each finished their run functions?
|
 |
sarvesh dikonda
Ranch Hand
Joined: Apr 08, 2012
Posts: 58
|
|
Hello Rachel. I guess you are right with your saying,that string "end concurrency" will NEVER be printed before mt1 and mt2 have each finished their run functions.
As you can see below i executed your code and found that Thread mt2 begins first and ends first followed by Thread mt1 followed by the string "end concurrency"
In thread mt2
In thread mt1
In thread mt1
In thread mt2
In thread mt1
In thread mt2
In thread mt1
In thread mt2
In thread mt1
In thread mt2
end concurrency)
But, as it is shown in the code that, it is thread mt2 that begins first, even though thread mt1 has a much higher priority in fact the highest priority in comparison with that of thread mt2.
Hope this helps!
|
Always believe in yourself
|
 |
Rachel Glenn
Ranch Hand
Joined: Oct 24, 2012
Posts: 95
|
|
sarvesh dikonda wrote:Hello Rachel. I guess you are right with your saying,that string "end concurrency" will NEVER be printed before mt1 and mt2 have each finished their run functions.
As you can see below i executed your code and found that Thread mt2 begins first and ends first followed by Thread mt1 followed by the string "end concurrency"
In thread mt2
In thread mt1
In thread mt1
In thread mt2
In thread mt1
In thread mt2
In thread mt1
In thread mt2
In thread mt1
In thread mt2
end concurrency)
But, as it is shown in the code that, it is thread mt2 that begins first, even though thread mt1 has a much higher priority in fact the highest priority in comparison with that of thread mt2.
Hope this helps!
thank you!
|
 |
 |
|
|
subject: thread join question
|
|
|