Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Reentrant mutex
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Practical use== [[W. Richard Stevens]] notes that recursive locks are "tricky" to use correctly, and recommends their use for adapting single-threaded code without changing [[Application programming interface|APIs]], but "only when no other solution is possible".<ref>{{cite book |title=Advanced Programming in the UNIX Environment |first1=W. Richard |last1=Stevens |first2=Stephen A. |last2=Rago |publisher=Addison-Wesley |year=2013 |page=434}}</ref> The [[Java (programming language)|Java]] language's native synchronization mechanism, [[Monitor (synchronization)|monitor]], uses recursive locks. Syntactically, a lock is a block of code with the 'synchronized' keyword preceding it and any [[Object (computer science)|Object]] reference in parentheses that will be used as the mutex. Inside the synchronized block, the given object can be used as a condition variable by doing a wait(), notify(), or notifyAll() on it. Thus all Objects are both recursive mutexes and [[condition variable]]s.<ref>{{cite book |chapter-url=http://goose.ycp.edu/~dhovemey/spring2011/cs365/lecture/lecture17.html |title=CS 365 - Parallel and Distributed Computing |chapter=Lecture 17: Java Threads, Synchronization |author=David Hovemeyer|work=Lecture notes, [[York College of Pennsylvania]] |access-date=2015-06-04 }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)