• 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
Thread safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Thread safe?


  • Subject: Thread safe?
  • From: Trygve Inda <email@hidden>
  • Date: Sat, 29 Mar 2008 13:44:56 +0000
  • Thread-topic: Thread safe?

I am finding it hard to determine in many cases exactly what is thread safe
as this is not complete:

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/Thr
eadSafetySummary/chapter_950_section_2.html

Can I call the following from a thread?

segImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
                               pixelsWide:100
                               pixelsHigh:100
                               bitsPerSample:8
                               samplesPerPixel:4
                               hasAlpha:YES
                               isPlanar:NO
                               colorSpaceName:NSDeviceRGBColorSpace
                               bitmapFormat:NSAlphaFirstBitmapFormat
                               bytesPerRow:100 * 4
                               bitsPerPixel:32];
    segBaseAddr = [segImageRep bitmapData];

    [segImageRep dealloc];

How about:

NSImage *    image = [[[NSImage alloc] initWithContentsOfFile:path]
autorelease];

    [NSGraphicsContext saveGraphicsState];
    [NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithBitmapImageRep:segImageRep]];

    [image drawInRect:NSMakeRect(0, 0, [image size].width, [image
size].height) fromRect:NSMakeRect(0, 0, [image size].width, [image
size].height) operation:NSCompositeCopy fraction:1.0];

    [NSGraphicsContext restoreGraphicsState];


I am trying to eliminate as much as possible calls to
detachNewThreadSelector since I can only pass these methods a single object.

Thanks,

Trygve


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Thread safe?
      • From: "Adam R. Maxwell" <email@hidden>
    • Re: Thread safe?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Core Data faulting and bindings: recursive KVO notifications?
  • Next by Date: Re: Communications between multiple NIB's
  • Previous by thread: Re: GDB says not an object
  • Next by thread: Re: Thread safe?
  • Index(es):
    • Date
    • Thread