• 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: Threads, messages and blocking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads, messages and blocking


  • Subject: Re: Threads, messages and blocking
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 29 May 2003 14:46:03 -0700

On Thursday, May 29, 2003, at 01:27 PM, Sean Harding wrote:

I have an Objective-C Cocoa application with two threads (NSThread). I need
thread 1 to tell thread 2 to do something and to know when thread 2 is done
doing it. But thread 1 must not block while thread 2 carries out its work
(if blocking was ok, I wouldn't even need a second thread).

Well, you could try locking an NSLock in thread 2, and then call the lock's -tryLock: method in thread 1. -tryLock: is an NSLock method that's like -lock, except that it doesn't block. If it can't get the lock, it returns NO and life goes on. Otherwise, it will get the lock and return YES. If I understand your problem correctly, maybe that will help?

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://dreamless.home.attbi.com/

"Great spirits have always encountered violent opposition from mediocre minds." - Albert Einstein
_______________________________________________
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.
References: 
 >Threads, messages and blocking (From: Sean Harding <email@hidden>)

  • Prev by Date: Re: Threads, messages and blocking
  • Next by Date: Re: NSString from Carbon by AppleEvent
  • Previous by thread: Re: Threads, messages and blocking
  • Next by thread: Re: Threads, messages and blocking
  • Index(es):
    • Date
    • Thread