• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

doubt in threads

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

Can you please make my doubt clear::

What is meant by thread holding lock on an object???

I did not get exactly what it means???

Thanks in advance..
 
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

If any thread enters into a synchronized block.Then that thread is having the lock on that object.If any thread wants to enter into that synchronized block,they have to wait untill the thread holding the lock completes it's execution(Means leaving the lock)

Thanks

Anil Kumar



SCJP 5.0,SCWCD 1.4
 
anveshana bandu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thankyou Anilkumar
I understood
 
Ranch Hand
Posts: 513
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, note that each object's lock can only be held by one thread at a time, but a thread can hold multiple object locks simultaneously.
 
anveshana bandu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Kelvin lim

I understood what anil said..

But a bit confused on what you said..can you please explain in detail..or with an example....I want to be clear of what you said..

I am verymuch grateful to you

Thanks in advance.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its pretty much clear what anil has said ........i dont think an example is needed to make it understand.........!A thread can hold multiple objects lock meaning to say instances of many classes ..........!Gotcha ?
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy ex "Siddalinga K M" now "siddu.sjce"!

Please have a look into your private messages by clicking the "My Private Messages" link near the top of this page.


Yours,
Bu.
[ November 24, 2007: Message edited by: Burkhard Hassel ]
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic