Hi all..
can anyone give a info/snippet of an implementation of a Thread safe static method...
Details:
I am having a method +(void)writeLog in class LogClass... In that i am opening a file for writing using NSFileHandle.
But being a static method.. called in many classes, across thread...
I want to make it thread safe... how???
Can @synchronized help me??? But what paramaeter i pass for @synchronized??
method...
can anyone give a info/snippet of an implementation of a Thread safe static method...
Details:
I am having a method +(void)writeLog in class LogClass... In that i am opening a file for writing using NSFileHandle.
But being a static method.. called in many classes, across thread...
Code:
[ LogClass writeLog:string]
I want to make it thread safe... how???
Can @synchronized help me??? But what paramaeter i pass for @synchronized??
method...
Code:
+(void)writeLog:(NSString*)str
{
// open file for writing using NSFileHandle.
// seek to end of file.
// write the data
// [filehandle closeFile]; (i removed this line as i am getting exception)
}