• 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:

When is lock released?

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a) yield
b) sleep
c) interrupt
d) wait
e) stop
f) suspend
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maria,
I would say:
d) wait it's an Object method and releases the lock on the particular object whose reference was used to call it.
e) stop it's a Thread method and releases all the locks one Thread has.
------------
a) yield keeps the locks and only allows Threads that are in a runnable state (not waiting on a lock for instance) to run.
b) sleep keeps the lock and temporarily cease execution for the specified time
c) interrupt is called from another Thread on a Thread that is waiting, sleeping, or blocked in a I/O
d) suspend holds its threads.
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was my experience that the deprecated thread methods, stop, suspend and resume, do not appear on the exam. Of course, further input from Kathy or Bert would be helpful.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic