b70ec4d9f0
Fixes #10302 I really am not sure I'm doing this right, so here goes nothing... Also testing this isn't easy. I don't have any other *nix boxes besides a Linux one. Test code: ```rust use std::thread; use std::io::timer::sleep; use std::time::duration::Duration; fn make_thread<'a>(i: i64) -> thread::JoinGuard<'a, ()> { thread::Builder::new().name(format!("MyThread{}", i).to_string()).scoped(move || { println!("Start: {}", i); sleep(Duration::seconds(i)); println!("End: {}", i); }) } fn main() { let mut guards = vec![make_thread(3)]; for i in 4i64..16 { guards.push(make_thread(i)); } } ``` GDB output on my machine: ``` (gdb) info threads Id Target Id Frame 15 Thread 0x7fdfbb35f700 (LWP 23575) "MyThread3" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 14 Thread 0x7fdfba7ff700 (LWP 23576) "MyThread4" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 13 Thread 0x7fdfba5fe700 (LWP 23577) "MyThread5" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 12 Thread 0x7fdfba3fd700 (LWP 23578) "MyThread6" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 11 Thread 0x7fdfb8dfe700 (LWP 23580) "MyThread4" 0x00007fdfbb746193 in select () from /usr/lib/libc.so.6 10 Thread 0x7fdfb8fff700 (LWP 23579) "MyThread7" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 9 Thread 0x7fdfb8bfd700 (LWP 23581) "MyThread8" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 8 Thread 0x7fdfb3fff700 (LWP 23582) "MyThread9" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 7 Thread 0x7fdfb3dfe700 (LWP 23583) "MyThread10" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 6 Thread 0x7fdfb3bfd700 (LWP 23584) "MyThread11" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 5 Thread 0x7fdfb2bff700 (LWP 23585) "MyThread12" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 4 Thread 0x7fdfb29fe700 (LWP 23586) "MyThread13" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 3 Thread 0x7fdfb27fd700 (LWP 23587) "MyThread14" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 2 Thread 0x7fdfb1bff700 (LWP 23588) "MyThread15" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0 * 1 Thread 0x7fdfbc411800 (LWP 23574) "threads" 0x00007fdfbbe2e505 in pthread_join () from /usr/lib/libpthread.so.0 ``` (I'm not sure why one of the threads is duplicated, but it does that without my patch too...) |
||
---|---|---|
.. | ||
collections | ||
ffi | ||
num | ||
old_io | ||
path | ||
prelude | ||
rand | ||
rt | ||
sync | ||
sys | ||
thread_local | ||
time | ||
ascii.rs | ||
bool.rs | ||
dynamic_lib.rs | ||
failure.rs | ||
fmt.rs | ||
lib.rs | ||
macros.rs | ||
os.rs | ||
rtdeps.rs | ||
thread.rs | ||
thunk.rs | ||
tuple.rs | ||
unit.rs |