这是防止多个线程访问函数MyTaskF的正确方法吗?
.h文件:
@interface MyInterface : NSObject {
//... some other stuff here
}
.m文件:
static NSLock *mytaskMutex;
static MyInterface *MyInterfaceSingleton;
int MyTaskF(int iVar)
{
[mytaskMutex lock];
//do stuff in here
[mytaskMutex unlock];
return 0;
}