#15211: KDL in MultiLocker::ReadLock()
-----------------------------+----------------------------
Reporter: 3dEyes | Owner: waddlesplash
Type: bug | Status: assigned
Priority: normal | Milestone: Unscheduled
Component: System/Kernel | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
-----------------------------+----------------------------
Comment (by tqh):
So you ask should I grab the lock or do something else depending on the
state. The state however changes at any point as any other thread may lock
or unlock in the meantime.
If it is not locked then you should lock, but another thread asked the
same and got the same answer. So you have two threads that think that they
are the ones that should lock. If it was done as an transaction (ie
protected by a lock) the other thread would see that it was locked
already).
Look at Ingo's RWLocker for how he has a lock to protect and do the action
in one transaction.
--
Ticket URL: <https://dev.haiku-os.org/ticket/15211#comment:17>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.