Function report |
Source Code:kernel\locking\rwsem.c |
Create Date:2022-07-28 09:48:10 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:This function must be called with the sem->wait_lock held to prevent* race conditions between checking the rwsem wait list and setting the* If wstate is WRITER_HANDOFF, it will make sure that either the handoff
Proto:static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, enum writer_wait_state wstate)
Type:bool
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct rw_semaphore * | sem | >count accordingly. |
| enum writer_wait_state | wstate |
| 568 | lockdep_assert_held( & wait_lock) |
| 570 | count = atomic_long_read( & count) |
| 571 | Do |
| 572 | has_handoff = Not Not (count & RWSEM_FLAG_HANDOFF) |
| 574 | If has_handoff && wstate == Writer is not first in wait list Then Return false |
| 579 | If count & RWSEM_LOCK_MASK Then |
| 580 | If has_handoff || wstate != WRITER_HANDOFF Then Return false |
| 583 | new |= RWSEM_FLAG_HANDOFF |
| 584 | Else |
| 591 | When Not atomic_long_try_cmpxchg_acquire( & count, & count, new) cycle |
| 597 | If new & RWSEM_FLAG_HANDOFF Then Return false |
| 601 | Return true |
| Name | Describe |
|---|---|
| rwsem_down_write_slowpath | Wait until we successfully acquire the write lock |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |