File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,15 @@ impl NSThread {
4141 let obj: * mut NSString = unsafe { msg_send ! [ self , name] } ;
4242 unsafe { Id :: retain_autoreleased ( obj) }
4343 }
44+
45+ fn new ( ) -> Id < Self , Shared > {
46+ let obj: * mut Self = unsafe { msg_send ! [ Self :: class( ) , new] } ;
47+ unsafe { Id :: new ( obj) } . unwrap ( )
48+ }
49+
50+ fn start ( & self ) {
51+ unsafe { msg_send ! [ self , start] }
52+ }
4453}
4554
4655/// Whether the application is multithreaded according to Cocoa.
@@ -53,14 +62,21 @@ pub fn is_main_thread() -> bool {
5362 unsafe { msg_send_bool ! [ NSThread :: class( ) , isMainThread] }
5463}
5564
65+ #[ allow( unused) ]
66+ fn make_multithreaded ( ) {
67+ let thread = NSThread :: new ( ) ;
68+ thread. start ( ) ;
69+ // Don't bother waiting for it to complete!
70+ }
71+
5672#[ cfg( test) ]
5773mod tests {
5874 use super :: * ;
5975
6076 #[ test]
6177 #[ cfg_attr(
6278 feature = "gnustep-1-7" ,
63- should_panic = "Could not retrieve main thread"
79+ ignore = "Retrieving main thread is weirdly broken, only works with --test-threads=1 "
6480 ) ]
6581 fn test_main_thread ( ) {
6682 let current = NSThread :: current ( ) ;
You can’t perform that action at this time.
0 commit comments