diff options
author | Torvald Riegel <triegel@redhat.com> | 2014-12-15 22:49:29 +0100 |
---|---|---|
committer | Torvald Riegel <triegel@redhat.com> | 2014-12-15 22:49:29 +0100 |
commit | d52c62df3d7574906dde1dea23f8a71e85073b06 (patch) | |
tree | b2c4adc4eca4da3caead86e0420b03365897ed1a /nptl/lowlevellock.c | |
parent | 045a6bcdd2d9c5c83f01171775998ef3104eb10f (diff) | |
download | glibc-d52c62df3d7574906dde1dea23f8a71e85073b06.tar.gz glibc-d52c62df3d7574906dde1dea23f8a71e85073b06.tar.xz glibc-d52c62df3d7574906dde1dea23f8a71e85073b06.zip |
Add comments for the generic lowlevellock implementation.
Patch by Bernard Ogden <bernie.ogden@linaro.org>.
Diffstat (limited to 'nptl/lowlevellock.c')
-rw-r--r-- | nptl/lowlevellock.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/nptl/lowlevellock.c b/nptl/lowlevellock.c index 4c093fcb01..e1a203bdd1 100644 --- a/nptl/lowlevellock.c +++ b/nptl/lowlevellock.c @@ -27,10 +27,10 @@ void __lll_lock_wait_private (int *futex) { if (*futex == 2) - lll_futex_wait (futex, 2, LLL_PRIVATE); + lll_futex_wait (futex, 2, LLL_PRIVATE); /* Wait if *futex == 2. */ while (atomic_exchange_acq (futex, 2) != 0) - lll_futex_wait (futex, 2, LLL_PRIVATE); + lll_futex_wait (futex, 2, LLL_PRIVATE); /* Wait if *futex == 2. */ } @@ -40,10 +40,10 @@ void __lll_lock_wait (int *futex, int private) { if (*futex == 2) - lll_futex_wait (futex, 2, private); + lll_futex_wait (futex, 2, private); /* Wait if *futex == 2. */ while (atomic_exchange_acq (futex, 2) != 0) - lll_futex_wait (futex, 2, private); + lll_futex_wait (futex, 2, private); /* Wait if *futex == 2. */ } @@ -75,7 +75,7 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime, int private) if (rt.tv_sec < 0) return ETIMEDOUT; - /* Wait. */ + /* If *futex == 2, wait until woken or timeout. */ lll_futex_timed_wait (futex, 2, &rt, private); } @@ -83,6 +83,11 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime, int private) } +/* The kernel notifies a process which uses CLONE_CHILD_CLEARTID via futex + wake-up when the clone terminates. The memory location contains the + thread ID while the clone is running and is reset to zero by the kernel + afterwards. The kernel up to version 3.16.3 does not use the private futex + operations for futex wake-up when the clone terminates. */ int __lll_timedwait_tid (int *tidp, const struct timespec *abstime) { @@ -113,8 +118,10 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime) if (rt.tv_sec < 0) return ETIMEDOUT; - /* Wait until thread terminates. The kernel so far does not use - the private futex operations for this. */ + /* If *tidp == tid, wait until thread terminates or the wait times out. + The kernel up to version 3.16.3 does not use the private futex + operations for futex wake-up when the clone terminates. + */ if (lll_futex_timed_wait (tidp, tid, &rt, LLL_SHARED) == -ETIMEDOUT) return ETIMEDOUT; } |