Re: DO vs NSLock with threads and AppKit
Re: DO vs NSLock with threads and AppKit
- Subject: Re: DO vs NSLock with threads and AppKit
- From: Raphael Sebbe <email@hidden>
- Date: Mon, 23 Jul 2001 15:38:17 +0200
Thread safety applies when you can or can't access/modify the same data
from multiple threads.
For the AppKit, there is one additional constraint : every call must
occur from the main thread (AppKit thread or drawing thread...). And
this is why DO is used (messages sent from one thread are processed back
into the main thread). You could also use NSPorts or even other
mecanisms. NSLocks can't help you, because they won't switch threads
obviously... They can only be used to protect data accessed from
multiple threads.
Raphael
On Monday, July 23, 2001, at 03:12 PM, Christian Mike wrote:
I understand that the AppKit is not thread safe. I am a little confused,
however, about when you can use an NSLock to make it thread safe versus
when
you must use DO.
For instance, if I am simply sending a setStringValue to an NSTextField,
should I use DO, or will an NSLock be good enough?
Are there cases when an NSLock would not work as opposed to DO?
Thanks.
Michael Christian
Thomson multimedia Inc.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev