Re: NSThreads, NSMutableArray
Re: NSThreads, NSMutableArray
- Subject: Re: NSThreads, NSMutableArray
- From: John Hörnkvist <email@hidden>
- Date: Sun, 6 May 2001 00:05:03 +0200
On Saturday, May 5, 2001, at 11:46 PM, email@hidden wrote:
create n threads, which do the same function
from another class (not sure how to set toObject otherwise)
Something like this:
NSEnumerator* enumerator=[myObjects objectEnumerator];
id anObject=nil;
while(anObject=[enumerator nextObject])
{
[NSThread detachNewThreadSelector:@selector(doSomething:)
toTarget:anObject withObject:nil];
}
or, if it's all to the same object:
int i;
for (i=0;i<n;i++)
{
[NSThread detachNewThreadSelector:@selector(doSomething:)
toTarget:anObject withObject:nil];
}
Regards,
John Hornkvist