• 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: NSThread in Debug mode loading code issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread in Debug mode loading code issue


  • Subject: Re: NSThread in Debug mode loading code issue
  • From: James Bucanek <email@hidden>
  • Date: Sat, 17 Jun 2006 13:11:30 -0700

Marc Van Olmen wrote on Saturday, June 17, 2006:

>hi,
>
>I create a thread that is doing the following:
>
>   anObject = [[MyBitmap alloc] initWithContents:aPath];
>
>When I create 2 of those threads right after each other. There is an
>issue that in one of the threads the variable
>anObject == NULL.
>I noticed that in the other thread it is like busy loading the code
>for MyBitmap ( it is busy loading also some CoreGraphics code.
>
>So my guess is that the ZeroLink has issues when it is loading a
>class and not 2 threads can do this at the same time?

I doubt this has anything to do with ZeroLink, other than the timing of ZeroLink is probably exposing a race condition in your code. Or, said another way, ZeroLink slightly purturbs the timing of your application and you see the bug.

If I had to take a wild guess (and without any other details), I'd say that anObject is probably a global or an instance variable of an object and you've started two threads using the same object. These two threads are, therefore, sharing the same variable and one is clearing the value while the second thread is trying to use it. This is pretty common multi-thread bug.

James
--
James Bucanek
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSThread in Debug mode loading code issue
      • From: Marc Van Olmen <email@hidden>
References: 
 >NSThread in Debug mode loading code issue (From: Marc Van Olmen <email@hidden>)

  • Prev by Date: Re: Print a NSTextView on two (or more) columns
  • Next by Date: Detecting Illegitimate OS X Installations?
  • Previous by thread: NSThread in Debug mode loading code issue
  • Next by thread: Re: NSThread in Debug mode loading code issue
  • Index(es):
    • Date
    • Thread