bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #25307] [NSConditionLock tryLockWhenCondition:] shouldn't throw exc


From: Richard Frith-Macdonald
Subject: [bug #25307] [NSConditionLock tryLockWhenCondition:] shouldn't throw exception when lock is unavailable
Date: Sat, 17 Jan 2009 08:40:26 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1

Follow-up Comment #2, bug #25307 (project gnustep):

If this is about the exception thrown if a single thread attempts to lock the
same lock twice, it's not a behavior specific to NSConditionLock (only an
NSRecursiveLock is allowed to be locked twice by a thread).

If the exception is something else, please disregard the rest of this
comment...

The Cocoa documentation actually says nothing about exceptions in this case,
but  I recall there was some discussion about lock behavior a few years ago,
which concluded that the GNUstep behavior was the best available ... it
returns NO if the lock is unavailable, but raises an exception if you try to
lock the lock twice from the same thread, since locking twice from the same
thread is almost guaranteed to be a programming error.

If we want to remove this check, we need to do it consistently for all locks
and document the new behavior.
Perhaps we could change to logging a warning instead of raising an exception
(and/or restricting the behavior to the debug version of the library) ... once
we have tested MacOS-X behavior with a test case.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25307>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]