• 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: Re: Synchronizing Thread Execution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Synchronizing Thread Execution


  • Subject: Re: Re: Synchronizing Thread Execution
  • From: "Shawn Erickson" <email@hidden>
  • Date: Mon, 4 Dec 2006 18:43:31 -0800

On 12/4/06, leenoori <email@hidden> wrote:
El 5/12/2006, a las 1:04, Rosyna escribió:

> http://www.opensource.apple.com/darwinsource/10.3.2/objc4-235/
> runtime/objc-sync.m
>
> http://www.opensource.apple.com/darwinsource/10.3.3/objc4-237/
> runtime/objc-sync.m
>
> Compare and contrast the 10.3.2 code with the 10.3.3 code.

Well, had a look and can't really grok what might be unsafe about the
10.3.2 version... Can you be more specific?

In the implementation mutex instances are held in a linked list... in essences a cache of mutex that are either in use or available for reuse. The link list data structure and the bookkeeping data in each node of the link list are protected by a lock. This is needed so that a given mutex is used by multiple threads to synchronize critical sections of code against the same object (pointer, aka the value supplied to the @synchronized statement).

In the 10.3.2 version however an aspect of the bookkeeping data
(lockCount and object of SyncData) is modified outside of the lock
that protects the the link list and its data. The end result is the
possibility that  different threads could use the same mutex instance
to synchronize against different objects instead of using two
different mutex instances like they really should be.

The 10.3.3 version corrects this issue by only modifying / evaluating
the link list and node data while holding the lock that protects that
data.

-Shawn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >Synchronizing Thread Execution (From: Antonio Nunes <email@hidden>)
 >Re: Re: Synchronizing Thread Execution (From: "Shawn Erickson" <email@hidden>)
 >Re: Synchronizing Thread Execution (From: leenoori <email@hidden>)

  • Prev by Date: Re: Progressbar does not survive hide/show
  • Next by Date: Re: Synchronizing Thread Execution
  • Previous by thread: Re: Synchronizing Thread Execution
  • Next by thread: Re: Re: Re: Synchronizing Thread Execution
  • Index(es):
    • Date
    • Thread