• 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: Multiple problems caused by changing NSThread sleepUntilDate interval
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple problems caused by changing NSThread sleepUntilDate interval


  • Subject: Re: Multiple problems caused by changing NSThread sleepUntilDate interval
  • From: Pete Yandell <email@hidden>
  • Date: Mon, 2 Feb 2004 17:44:10 +1100

Well, there's the obvious Cocoa docs:

file:///Developer/Documentation/Cocoa/Conceptual/Multithreading/ index.html

That gives a really basic introduction, but threading is a big and complex issue...many a thesis has been written!

Anybody know of a good gentle introduction to threads and synchronisation on the web or in a book? I've got my old university notes, but that's not much use to anyone.

Pete Yandell
http://pete.yandell.com/

On 02/02/2004, at 3:39 PM, Mike Brinkman wrote:

Yeah, definitely true. This whole app is just a modification of Mike Beam's
"Intro to Cocoa Animation" tutorial on MacDevCenter. He introduced the
thread concept in that article, but there's nothing about locking, etc. Any
leads where I could read more about threading?

Mike

On 2/1/04 10:24 PM, "Pete Yandell" <email@hidden> wrote:

Mike,

Your crashing problem is because you're using the variable pt in two
different threads without any sort of locking.

pt is created, destroyed and updated in the keyDown: method of your
main thread, but you use it to do transformations in your worker
thread. It's only a matter of time before pt is in the middle of being
modified when you try to use it, hence the crash. A simple run in the
debugger shows that the seg fault occurs when you're doing [pPaddle
transformUsingAffineTransform:pt] in the worker thread.

I'm betting the bounds issue is also related. You do weird things with
the relationship between pt and pPaddle in the two threads.

You need to go and read some more about threads and locking!

Pete Yandell
http://pete.yandell.com/
_______________________________________________
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: 
 >Re: Multiple problems caused by changing NSThread sleepUntilDate interval (From: Mike Brinkman <email@hidden>)

  • Prev by Date: Proper use of controllers
  • Next by Date: MEETING: Chicago - Tuesday Feb 3rd 6:00 PM
  • Previous by thread: Re: Multiple problems caused by changing NSThread sleepUntilDate interval
  • Next by thread: Row moving [source]
  • Index(es):
    • Date
    • Thread