The following program triggers this:
use std::thread::Thread;
fn main() {
Thread::spawn(move || { println!("Hello"); }).join();
println!("After join");
}
When compiled on DragonFly with most recent rust (and all versions since the removal of rustrt), it fails with:
hello
thread '<main>' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `22`, right: `0`)',
/home/..../rust/src/libstd/sys/unix/mutex.rs:53
The code that fails is:
let r = ffi::pthread_mutex_destory(self.inner.get());
debug_assert_eq!(r, 0);
It returns with error code 22 (EINVAL) instead of 0. To me it seems that Mutex::destroy() is called twice! It might be related to the new TLS thread_local code and destructor support, but it's pretty hard to understand, so any ideas how to track the bug further down and fix it is welcomed.
The following program triggers this:
When compiled on DragonFly with most recent rust (and all versions since the removal of rustrt), it fails with:
The code that fails is:
It returns with error code 22 (EINVAL) instead of 0. To me it seems that Mutex::destroy() is called twice! It might be related to the new TLS thread_local code and destructor support, but it's pretty hard to understand, so any ideas how to track the bug further down and fix it is welcomed.