Lock me tender, lock me true
Lock me tender, lock me true
- Subject: Lock me tender, lock me true
- From: email@hidden
- Date: Sat, 5 Oct 2002 20:07:09 +0200
Stupid question for some stupid code.
While coding something I managed to get this kind of code to get
executed within an AppKit application:
[NSThread detachNewThreadSelector:@selector(threadedMethod:)
toTarget:self withObject:self];
- (void) threadedMethod:(id) sender
{
NSAutoreleasePool * pool=....
while (1)
{
NSLock * tLock;
tLock=[[NSLock alloc] init];
[tLock lock];
[tLock unlock];
[tLock release];
}
[pool release];
}
When this thread ran, the whole Mac OS X interface is locked/frozen.
When I speak of the interface, I'm speaking of the Dock being frozen,
the window not moving, being selected, etc...
Yesterday evening, I was able to freeze the whole OS with this kind of
code:
if (authorizationRef_!=NULL)
{
AuthorizationFree(authorizationRef_,kAuthorizationFlagDestroyRights);
}
[NSApp terminate:self];
Question: should these lines of code hang/freeze the OS or not? The
first one is bad coding and if I were on OS 9, I would understand. But
on OS X I'm a bit surprised it froze the OS (on a MP).
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.