• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: DO vs NSLock with threads and AppKit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: DO vs NSLock with threads and AppKit
      • From: Michael Horn <email@hidden>
  • Prev by Date: DO vs NSLock with threads and AppKit
  • Next by Date: Re: Goofy NSDrawer behavior
  • Previous by thread: DO vs NSLock with threads and AppKit
  • Next by thread: Re: DO vs NSLock with threads and AppKit
  • Index(es):
    • Date
    • Thread