Re: Read-Write Lock is Available?

2011-05-12 Thread Dave DeLong
There's a simple wrapper around the pthread_rwlock_t here:

http://cocoaheads.byu.edu/wiki/locks

Cheers,

Dave

On May 12, 2011, at 11:23 AM, Bing Li wrote:

> Dear Stephen and Lance,
> 
> I appreciate so much for your reply!
> 
> I am exactly sure if my approach is fine. I plan to protect the data that
> might be used concurrently with read-write locks. In the meantime, the
> concurrency is implemented using NSOperationQueue. Is it OK?
> 
> Best regards,
> Bing
> 
> On Fri, May 13, 2011 at 2:15 AM, Stephen J. Butler > wrote:
> 
>> On Thu, May 12, 2011 at 12:44 PM, Bing Li  wrote:
>>> I am writing concurrent code. I get used to the read-write lock on other
>>> development environment. However, according to the Threading Programming
>>> Guide from apple.com, Cocoa does not support the read-write lock? We can
>> use
>>> it with POSIX threads? Is that true?
>> 
>> It is safe to use POSIX threads RW locks with Cocoa threads.
>> 
>> man pthread_rwlock_init
>> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
> 
> This email sent to davedel...@me.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Read-Write Lock is Available?

2011-05-12 Thread Bing Li
Dear Stephen and Lance,

I appreciate so much for your reply!

I am exactly sure if my approach is fine. I plan to protect the data that
might be used concurrently with read-write locks. In the meantime, the
concurrency is implemented using NSOperationQueue. Is it OK?

Best regards,
Bing

On Fri, May 13, 2011 at 2:15 AM, Stephen J. Butler  wrote:

> On Thu, May 12, 2011 at 12:44 PM, Bing Li  wrote:
> > I am writing concurrent code. I get used to the read-write lock on other
> > development environment. However, according to the Threading Programming
> > Guide from apple.com, Cocoa does not support the read-write lock? We can
> use
> > it with POSIX threads? Is that true?
>
> It is safe to use POSIX threads RW locks with Cocoa threads.
>
> man pthread_rwlock_init
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Read-Write Lock is Available?

2011-05-12 Thread Stephen J. Butler
On Thu, May 12, 2011 at 12:44 PM, Bing Li  wrote:
> I am writing concurrent code. I get used to the read-write lock on other
> development environment. However, according to the Threading Programming
> Guide from apple.com, Cocoa does not support the read-write lock? We can use
> it with POSIX threads? Is that true?

It is safe to use POSIX threads RW locks with Cocoa threads.

man pthread_rwlock_init
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Read-Write Lock is Available?

2011-05-12 Thread lbland
hi-

On May 12, 2011, at 1:44 PM, Bing Li wrote:

> I am writing concurrent code. I get used to the read-write lock on other
> development environment. However, according to the Threading Programming
> Guide from apple.com, Cocoa does not support the read-write lock? We can use
> it with POSIX threads? Is that true?

have you looked at the mutex variable, or NSLock? Also, the darwin mail list 
may be better for you.

Are your threads in a single process or not? ... that can make a difference in 
the answer ...

thanks!-

-lance

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Read-Write Lock is Available?

2011-05-12 Thread Bing Li
Dear all,

I am writing concurrent code. I get used to the read-write lock on other
development environment. However, according to the Threading Programming
Guide from apple.com, Cocoa does not support the read-write lock? We can use
it with POSIX threads? Is that true?

Thanks so much!
Bing
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com