if (obj) {
SyncData* data = id2data(obj, ACQUIRE);
- assert(data);
+ ASSERT(data);
data->mutex.lock();
} else {
// @synchronized(nil) does nothing
return result;
}
+BOOL objc_sync_try_enter(id obj)
+{
+ BOOL result = YES;
+
+ if (obj) {
+ SyncData* data = id2data(obj, ACQUIRE);
+ ASSERT(data);
+ result = data->mutex.tryLock();
+ } else {
+ // @synchronized(nil) does nothing
+ if (DebugNilSync) {
+ _objc_inform("NIL SYNC DEBUG: @synchronized(nil); set a breakpoint on objc_sync_nil to debug");
+ }
+ objc_sync_nil();
+ }
+
+ return result;
+}
+
// End synchronizing on 'obj'.
// Returns OBJC_SYNC_SUCCESS or OBJC_SYNC_NOT_OWNING_THREAD_ERROR