Re: are nsstrings internally locked? (nsmutablestrings actually)
Re: are nsstrings internally locked? (nsmutablestrings actually)
- Subject: Re: are nsstrings internally locked? (nsmutablestrings actually)
- From: Philip George <email@hidden>
- Date: Thu, 24 Jul 2003 11:20:05 -0500
Ok, here's the official answer, in case you want to know. I could have
sworn that I had already read through this article with respect to this
particular question, but apparently not. This is from the "Multithreading"
doc that you can get to via the "NSThread" API reference document.
"In general, immutable objects are thread-safe. Once you create them, you
can safely pass these objects to and from threads. On the other hand,
mutable objects are not thread-safe. To use mutable objects in a threaded
application, the application must synchronize appropriately (see "Locks" and
"Using Locks")."
Guess that settles that. Ugh. Thought I was going to get a break on this
one, but apparently not. My fingers are numb from typing variants of the
word "lock" so many times. I need a programmable 4-button mouse so I can
assign the word "lock" to the 4th button. ;)
- Philip
On 7/22/03 6:40 PM, "Philip George" <email@hidden> wrote:
>
I'm doing a ton of nslocking on multiple threads for fear of caching a partial
>
nsmutablestring from one thread while another was trying to modify it. Should
>
I be worried about this? Are nsstring/nsmutablestring objects locked
>
internally? I have yet to actually SEE with my own two eyes an
>
NSMutableString get interrupted by another thread while being modified with
>
the setString: method, but that's no proof that it couldn't happen.
>
>
Anyone know for sure?
>
>
I'd love to not have to write all this extra locking code if it were possible.
>
:)
>
>
Thanks.
>
>
- Philip
_______________________________________________
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.