Thread Join Method

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Thread Join Method

Nitin chaudhary

Hi Concurrency Experts,

Apologize for filling your mail boxes with my stupidity.

It might be a stupid question but I am unable to understand the behaviour of join Method.

Attached two program 1 program 'JoinExample' in line number 24, calling  join on thread t and waits until thread t finishes. Program finishes well.

But in Example Second 'NoVisibility' Line number 13, my Reader thread got stuck and it seems like halt for ever. It should call a loop second time but it did not. If possible kindly do let me know the reason.

Thank you in advance and pardon my English.

Regards,
Nitin Kumar
#:+91 9654151525

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

JoinExample.java (952 bytes) Download Attachment
NoVisibility.java (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Thread Join Method

David Holmes-6

Hi,

 

You can’t join() the currentThread() – you are waiting for yourself to terminate.

 

David

 

From: Concurrency-interest [mailto:[hidden email]] On Behalf Of Nitin chaudhary
Sent: Saturday, June 4, 2016 8:51 AM
To: [hidden email]
Subject: [concurrency-interest] Thread Join Method

 

 

Hi Concurrency Experts,

 

Apologize for filling your mail boxes with my stupidity.

 

It might be a stupid question but I am unable to understand the behaviour of join Method.

 

Attached two program 1 program 'JoinExample' in line number 24, calling  join on thread t and waits until thread t finishes. Program finishes well.

 

But in Example Second 'NoVisibility' Line number 13, my Reader thread got stuck and it seems like halt for ever. It should call a loop second time but it did not. If possible kindly do let me know the reason.

 

Thank you in advance and pardon my English.

 

Regards,

Nitin Kumar

#:+91 9654151525


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Thread Join Method

Alex Otenko
Surely this should throw an Exception

Alex

On 4 Jun 2016, at 00:34, David Holmes <[hidden email]> wrote:

Hi,
 
You can’t join() the currentThread() – you are waiting for yourself to terminate.
 
David
 
From: Concurrency-interest [[hidden email]] On Behalf Of Nitin chaudhary
Sent: Saturday, June 4, 2016 8:51 AM
To: [hidden email]
Subject: [concurrency-interest] Thread Join Method
 
 
Hi Concurrency Experts,
 
Apologize for filling your mail boxes with my stupidity.
 
It might be a stupid question but I am unable to understand the behaviour of join Method.
 
Attached two program 1 program 'JoinExample' in line number 24, calling  join on thread t and waits until thread t finishes. Program finishes well.
 
But in Example Second 'NoVisibility' Line number 13, my Reader thread got stuck and it seems like halt for ever. It should call a loop second time but it did not. If possible kindly do let me know the reason.
 
Thank you in advance and pardon my English.
 
Regards,
Nitin Kumar
#:+91 9654151525
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Thread Join Method

Viktor Klang
Think of backwards compatibility!

;)

On Wed, Jun 8, 2016 at 12:32 PM, Alex Otenko <[hidden email]> wrote:
Surely this should throw an Exception

Alex

On 4 Jun 2016, at 00:34, David Holmes <[hidden email]> wrote:

Hi,
 
You can’t join() the currentThread() – you are waiting for yourself to terminate.
 
David
 
From: Concurrency-interest [[hidden email]] On Behalf Of Nitin chaudhary
Sent: Saturday, June 4, 2016 8:51 AM
To: [hidden email]
Subject: [concurrency-interest] Thread Join Method
 
 
Hi Concurrency Experts,
 
Apologize for filling your mail boxes with my stupidity.
 
It might be a stupid question but I am unable to understand the behaviour of join Method.
 
Attached two program 1 program 'JoinExample' in line number 24, calling  join on thread t and waits until thread t finishes. Program finishes well.
 
But in Example Second 'NoVisibility' Line number 13, my Reader thread got stuck and it seems like halt for ever. It should call a loop second time but it did not. If possible kindly do let me know the reason.
 
Thank you in advance and pardon my English.
 
Regards,
Nitin Kumar
#:<a href="tel:%2B91%209654151525" value="+919654151525" target="_blank">+91 9654151525
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest




--
Cheers,

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Thread Join Method

David Holmes-6
In reply to this post by Alex Otenko

Sure it could have been spec’d that way 20 years ago and every use burdened with a currentThread() check. But it wasn’t.

 

There a lots of ways to “shoot yourself in the foot”.

 

David

 

From: Concurrency-interest [mailto:[hidden email]] On Behalf Of Alex Otenko
Sent: Wednesday, June 8, 2016 8:32 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [concurrency-interest] Thread Join Method

 

Surely this should throw an Exception

 

Alex

 

On 4 Jun 2016, at 00:34, David Holmes <[hidden email]> wrote:

 

Hi,

 

You can’t join() the currentThread() – you are waiting for yourself to terminate.

 

David

 

From: Concurrency-interest [[hidden email]] On Behalf Of Nitin chaudhary
Sent: Saturday, June 4, 2016 8:51 AM
To: [hidden email]
Subject: [concurrency-interest] Thread Join Method

 

 

Hi Concurrency Experts,

 

Apologize for filling your mail boxes with my stupidity.

 

It might be a stupid question but I am unable to understand the behaviour of join Method.

 

Attached two program 1 program 'JoinExample' in line number 24, calling  join on thread t and waits until thread t finishes. Program finishes well.

 

But in Example Second 'NoVisibility' Line number 13, my Reader thread got stuck and it seems like halt for ever. It should call a loop second time but it did not. If possible kindly do let me know the reason.

 

Thank you in advance and pardon my English.

 

Regards,

Nitin Kumar

#:+91 9654151525

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

 


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Thread Join Method

Remi Forax
Technically, this one doesn't allow to shout yourself into the foot because you're frozen before :)

Rémi


De: "David Holmes" <[hidden email]>
À: "Alex Otenko" <[hidden email]>, [hidden email]
Cc: [hidden email]
Envoyé: Mercredi 8 Juin 2016 14:20:40
Objet: Re: [concurrency-interest] Thread Join Method

Sure it could have been spec’d that way 20 years ago and every use burdened with a currentThread() check. But it wasn’t.

 

There a lots of ways to “shoot yourself in the foot”.

 

David

 

From: Concurrency-interest [mailto:[hidden email]] On Behalf Of Alex Otenko
Sent: Wednesday, June 8, 2016 8:32 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [concurrency-interest] Thread Join Method

 

Surely this should throw an Exception

 

Alex

 

On 4 Jun 2016, at 00:34, David Holmes <[hidden email]> wrote:

 

Hi,

 

You can’t join() the currentThread() – you are waiting for yourself to terminate.

 

David

 

From: Concurrency-interest [[hidden email]] On Behalf Of Nitin chaudhary
Sent: Saturday, June 4, 2016 8:51 AM
To: [hidden email]
Subject: [concurrency-interest] Thread Join Method

 

 

Hi Concurrency Experts,

 

Apologize for filling your mail boxes with my stupidity.

 

It might be a stupid question but I am unable to understand the behaviour of join Method.

 

Attached two program 1 program 'JoinExample' in line number 24, calling  join on thread t and waits until thread t finishes. Program finishes well.

 

But in Example Second 'NoVisibility' Line number 13, my Reader thread got stuck and it seems like halt for ever. It should call a loop second time but it did not. If possible kindly do let me know the reason.

 

Thank you in advance and pardon my English.

 

Regards,

Nitin Kumar

#:+91 9654151525

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

 


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest