here is my code, i'm new to NSThread, why these code doesn't execute? plz help.
Basically i have a viewcontroller, and i call TESTC() when a button is pressed, you should know TESTC() is a C function. Thanks in advance.
@interface Worker : NSObject
@property (nonatomic, strong) NSThread *thread;
- (void)performTask1 : (void *)context;
@end
@implementation Worker
- (instancetype)init
{
if (self = [super init]) {
_thread = [[NSThread alloc] init];
}
return self;
}
- (void)performTask1 : (void *)context
{
[self performSelector:@selector(Task1) onThread:self.thread withObject:(__bridge id _Nullable)(context) waitUntilDone:YES];
}
- (void)Task1
{
NSLog(@"Task1 proceed");
}
@end
void TESTC()
{
Worker *kelvin = [[Worker alloc] init];
[kelvin performTask1:nil];
}