File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,18 @@ impl Mutex {
2828 //
2929 // A pthread mutex initialized with PTHREAD_MUTEX_INITIALIZER will have
3030 // a type of PTHREAD_MUTEX_DEFAULT, which has undefined behavior if you
31- // try to re-lock it from the same thread when you already hold a lock.
31+ // try to re-lock it from the same thread when you already hold a lock
32+ // (https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_init.html).
3233 //
3334 // In practice, glibc takes advantage of this undefined behavior to
3435 // implement hardware lock elision, which uses hardware transactional
35- // memory to avoid acquiring the lock. While a transaction is in
36+ // memory to avoid acquiring the lock.
37+ // This is the case even if PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL
38+ // (https://github.com/rust-lang/rust/issues/33770#issuecomment-220847521).
39+ // As a consequence, while a transaction is in
3640 // progress, the lock appears to be unlocked. This isn't a problem for
3741 // other threads since the transactional memory will abort if a conflict
38- // is detected, however no abort is generated if re-locking from the
42+ // is detected, however no abort is generated when re-locking from the
3943 // same thread.
4044 //
4145 // Since locking the same mutex twice will result in two aliasing &mut
You can’t perform that action at this time.
0 commit comments