This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GNU Objective-C runtime support for @synchronized()


Hi Nicola,

welcome back, ObjC can use all the help it can get :-)

I haven't tried the patch yet (having read a subsequent mail).

Looks like a great clean-up.

On 4 Sep 2010, at 21:44, Nicola Pero wrote:

The only real problem is that I am not particularly convinced by
Apple's decision to have @synchronized(nil) do nothing. I think an
exception would have made more sense. At a moment, if @synchronized
is passed a nil object due to a bug, it would do no synchronization at
all and this problem could remain invisible until it causes a
hard-to-reproduce bug in a production system. Maybe in the GNU
runtime we could have a static lock associated with nil and have
@synchronized(nil) lock that global lock. That would still be
somewhat compatible with Apple's runtime (no exception raised if you do
@synchronized(nil)), but would prevent a bug triggering
a @synchronized(nil) from causing a lack of synchronization. ;-)

(IMO) this would be a good plan -- and I don't see why we shouldn't have a diagnostic too (and, perhaps, raise a radar).


Else, we'll just leave as it is, which is fully compatible with the Apple's
runtime behaviour. :-)

I'm getting tempted to add an -mcompat=apple for *-*-darwin* (I know Mike hates extra flags, but we're diverging)


Either way, it would be good to keep at least superficial compatibility.

----

on the subject of exceptions ......
.... any thoughts on http://gcc.gnu.org/bugzilla/show_bug.cgi? id=23616 ? ;-)


cheers,
Iain


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]