rust/src/libstd
Alex Crichton b70ec4d9f0 rollup merge of #21678: vojtechkral/threads-native-names
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...)
2015-01-30 12:02:53 -08:00
..
collections smoke out remaining bugs 2015-01-30 10:37:44 -05:00
ffi Rename FullRange to RangeFull 2015-01-30 12:01:08 +13:00
num s/Show/Debug/g 2015-01-29 07:49:02 -05:00
old_io s/Show/Debug/g 2015-01-29 07:49:02 -05:00
path fix fallout 2015-01-30 10:37:44 -05:00
prelude Rename FullRange to RangeFull 2015-01-30 12:01:08 +13:00
rand s/while let/for/g now that #21245 has been fixed 2015-01-30 10:37:45 -05:00
rt smoke out remaining bugs 2015-01-30 10:37:44 -05:00
sync s/while let/for/g now that #21245 has been fixed 2015-01-30 10:37:45 -05:00
sys rollup merge of #21678: vojtechkral/threads-native-names 2015-01-30 12:02:53 -08:00
thread_local Merge remote-tracking branch 'rust-lang/master' 2015-01-25 01:20:55 -08:00
time s/Show/Debug/g 2015-01-29 07:49:02 -05:00
ascii.rs s/while let/for/g now that #21245 has been fixed 2015-01-30 10:37:45 -05:00
bool.rs grandfathered -> rust1 2015-01-23 21:48:20 -08:00
dynamic_lib.rs Set unstable feature names appropriately 2015-01-23 13:28:40 -08:00
failure.rs Merge remote-tracking branch 'rust-lang/master' 2015-01-27 15:05:04 -08:00
fmt.rs Merge remote-tracking branch 'rust-lang/master' 2015-01-27 15:05:04 -08:00
lib.rs fixes after rebase 2015-01-30 10:37:45 -05:00
macros.rs Merge remote-tracking branch 'rust-lang/master' 2015-01-27 15:05:04 -08:00
os.rs s/Show/Debug/g 2015-01-29 07:49:02 -05:00
rtdeps.rs Set unstable feature names appropriately 2015-01-23 13:28:40 -08:00
thread.rs Thread native name setting, fix #10302 2015-01-28 13:48:27 +01:00
thunk.rs Set unstable feature names appropriately 2015-01-23 13:28:40 -08:00
tuple.rs grandfathered -> rust1 2015-01-23 21:48:20 -08:00
unit.rs grandfathered -> rust1 2015-01-23 21:48:20 -08:00