Skip to content

Commit fd10bd2

Browse files
workingjubileegitbot
authored and
gitbot
committed
Rollup merge of rust-lang#136908 - mustartt:aix-mutex-destory-einval, r=joboet
[AIX] expect `EINVAL` for `pthread_mutex_destroy` Calling `pthread_mutex_destory` on a mutex initalized with the static initializer macro `PTHREAD_MUTEX_INITIALIZER` will result in `EINVAL` if the mutex is not lock/unlocked prior to calling `pthread_mutex_destroy`.
2 parents 50cba69 + 6c3812a commit fd10bd2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: std/src/sys/pal/unix/sync/mutex.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ impl Drop for Mutex {
111111
// `PTHREAD_MUTEX_INITIALIZER`, which is valid at all locations. Thus,
112112
// this call always destroys a valid mutex.
113113
let r = unsafe { libc::pthread_mutex_destroy(self.raw()) };
114-
if cfg!(target_os = "dragonfly") {
115-
// On DragonFly pthread_mutex_destroy() returns EINVAL if called on a
116-
// mutex that was just initialized with libc::PTHREAD_MUTEX_INITIALIZER.
114+
if cfg!(any(target_os = "aix", target_os = "dragonfly")) {
115+
// On AIX and DragonFly pthread_mutex_destroy() returns EINVAL if called
116+
// on a mutex that was just initialized with libc::PTHREAD_MUTEX_INITIALIZER.
117117
// Once it is used (locked/unlocked) or pthread_mutex_init() is called,
118118
// this behaviour no longer occurs.
119119
debug_assert!(r == 0 || r == libc::EINVAL);

0 commit comments

Comments
 (0)