• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need info regarding threads

 
Yogesh Gandhi
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Output:
A = 0
Sleeping for 0 ms.
A = 1
Sleeping for 0 ms.
A = 2
Sleeping for 0 ms.
B = 0
Sleeping for 0 ms.
A = 3
Sleeping for 0 ms.
B = 1
Sleeping for 0 ms.
A = 4
Sleeping for 0 ms.
B = 2
Sleeping for 0 ms.
A = 5
B = 3
Sleeping for 0 ms.
B = 4
Sleeping for 0 ms.
B = 5


What I am wondering is, why is the value of delay coming as zero.
I need clarity about which object is being used, when a run method is invoked.

Regards
Yogesh
 
Yogesh Gandhi
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the mistake,

It should be

this.delay = delay and I was doing it otherwise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic