Skip to content

Commit 7acb719

Browse files
committed
Disable test_main_thread completely on GNUStep
1 parent 1d9c8df commit 7acb719

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

objc2-foundation/src/thread.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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)]
5773
mod 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();

0 commit comments

Comments
 (0)