Friday, April 19, 2013

NSThread setStackSize example objc


setStackSize:

Sets the stack size of the receiver.
- (void)setStackSize:(NSUInteger)s
Parameters
s
The stack size for the receiver. This value must be in bytes and a multiple of 4KB.
Discussion
You must call this method before starting your thread. Setting the stack size after the thread has started changes the attribute size (which is reflected by the stackSize method), but it does not affect the actual number of pages set aside for the thread.
Example - setStackSize

{
thread=[[NSThread alloc]initWithTarget:self selector:@selector(fibnocciForLoop) object:nil];
[thread start]; 
[thread setStackSize:4096]; // multiple of 4KB
}