• 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: Semaphore strangeness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Semaphore strangeness


  • Subject: Re: Semaphore strangeness
  • From: Greg Parker <email@hidden>
  • Date: Wed, 17 Apr 2013 17:55:20 -0700

On Apr 17, 2013, at 5:44 PM, Charles Srstka <email@hidden> wrote:
> On Apr 17, 2013, at 7:06 PM, Greg Parker <email@hidden> wrote:
>>
>> dispatch assumes you are using the semaphore in a lock-like pattern, where all waiters are expected to signal when they are done with their work. In that pattern, destroying a semaphore whose value is less than its original value indicates a bug somewhere (because somebody should have signaled the semaphore but has not yet done so). _dispatch_semaphore_dispose() is enforcing that assumption and deliberately halting your process if it fails.
>
> Then why not use something like an assertion or an exception which could actually let the user / developer know why you crashed, instead of just EXC_BAD_INSTRUCTION?

There should be a message in the crash log.

    if (dsema->dsema_value < dsema->dsema_orig) {
        DISPATCH_CLIENT_CRASH("Semaphore/group object deallocated while in use");
    }


--
Greg Parker     email@hidden     Runtime Wrangler



_______________________________________________

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

References: 
 >Semaphore strangeness (From: Quincey Morris <email@hidden>)
 >Re: Semaphore strangeness (From: Greg Parker <email@hidden>)
 >Re: Semaphore strangeness (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Semaphore strangeness
  • Next by Date: Re: NSOutlineView Travails
  • Previous by thread: Re: Semaphore strangeness
  • Next by thread: Re: Semaphore strangeness
  • Index(es):
    • Date
    • Thread