• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Threading and operation

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In following code snipet i didn't understood the Line which are in bold words



In above code,

1. at LINE 0 why this object is made of class Object?
2. at LINE 1 what is the use of syncObj there?
3. at LINE 2 Does the g() mehtod anything to do with threading?

Thanks in advance.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. at LINE 0 why this object is made of class Object?

In line 0, ir is instantiating an object -- most likely for use as an syncrhonization object.

2. at LINE 1 what is the use of syncObj there?

As suspected from the previous point, the object is used as a syncrhonization object.

3. at LINE 2 Does the g() mehtod anything to do with threading?

Keep in mind that the main thread is still a thread. Just because you didn't start it doesn't mean that it doesn't relate to threading. It is still running concurrent to the threads that you started.

Henry
 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Henry. I got it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic