Race condition: Difference between revisions

Content added Content deleted
(→‎Locks: - Added a few words concerning locking)
m (Improved link syntax)
Line 58: Line 58:
Languages with built-in threading syntax commonly provide very simple ways to enforce locks. Java provides the ''synchronized'' key word to designate a code block with enforced locking.
Languages with built-in threading syntax commonly provide very simple ways to enforce locks. Java provides the ''synchronized'' key word to designate a code block with enforced locking.


Ada provides ''protected objects'' with locking characteristics based upon the kind of access method described. A protected ''procedure'' enforces a write lock, allowing unconditional access to the object by only a single thread at a time. A protected ''entry'' enforces a write lock, allowing conditional access to the object by one thread at a time. A protected ''function'' provides a shared read lock, allowing multiple read access to the object at the same time. Many locking patterns[http://home.att.net/~jimmaureenrogers/Shared_Resource_Design_Patterns.html] can be defined using these three capabilities.
Ada provides ''protected objects'' with locking characteristics based upon the kind of access method described. A protected ''procedure'' enforces a write lock, allowing unconditional access to the object by only a single thread at a time. A protected ''entry'' enforces a write lock, allowing conditional access to the object by one thread at a time. A protected ''function'' provides a shared read lock, allowing multiple read access to the object at the same time. Many locking [http://home.att.net/~jimmaureenrogers/Shared_Resource_Design_Patterns.html patterns] can be defined using these three capabilities.


{{stub}}
{{stub}}