0

Is this the correct method to prevent more than one thread to access the function MyTaskF?

.h file:

@interface MyInterface  : NSObject {

//... some other stuff here

}

.m file:

static NSLock *mytaskMutex;

static MyInterface *MyInterfaceSingleton;

int MyTaskF(int iVar)
{

    [mytaskMutex lock];

    //do stuff in here

    [mytaskMutex unlock];

    return 0;
}
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
smartie1
  • 1
  • 1

0 Answers0