File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/tools/miri/tests/pass-dep/libc Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,22 @@ fn main() {
65
65
}
66
66
}
67
67
68
+ // Set name via Rust API, get it via pthreads.
69
+ let long_name2 = long_name. clone ( ) ;
70
+ thread:: Builder :: new ( )
71
+ . name ( long_name. clone ( ) )
72
+ . spawn ( move || {
73
+ let mut buf = vec ! [ 0u8 ; long_name2. len( ) + 1 ] ;
74
+ assert_eq ! ( get_thread_name( & mut buf) , 0 ) ;
75
+ let cstr = CStr :: from_bytes_until_nul ( & buf) . unwrap ( ) ;
76
+ let truncated_name = & long_name2[ ..long_name2. len ( ) . min ( MAX_THREAD_NAME_LEN - 1 ) ] ;
77
+ assert_eq ! ( cstr. to_bytes( ) , truncated_name. as_bytes( ) ) ;
78
+ } )
79
+ . unwrap ( )
80
+ . join ( )
81
+ . unwrap ( ) ;
82
+
83
+ // Set name via pthread and get it again (short name).
68
84
thread:: Builder :: new ( )
69
85
. spawn ( move || {
70
86
// Set short thread name.
@@ -130,6 +146,7 @@ fn main() {
130
146
. join ( )
131
147
. unwrap ( ) ;
132
148
149
+ // Set name via pthread and get it again (long name).
133
150
thread:: Builder :: new ( )
134
151
. spawn ( move || {
135
152
// Set full thread name.
You can’t perform that action at this time.
0 commit comments