synchronized到objc_sync_enter/objc_sync_exit
synchronized
->objc_sync_enter/objc_sync_exit
objc_sync_enter
:
递归锁,与objc_sync_exit
配合使用,注意死锁
- Begin synchronizing on ‘obj’. Allocates recursive pthread_mutex associated with ‘obj’ if needed.
- Parameters obj The object to begin synchronizing on.
- Returns OBJC_SYNC_SUCCESS once lock is acquired.
objc_sync_exit
- End synchronizing on ‘obj’.
- Parameters obj The object to end synchronizing on.
- Returns OBJC_SYNC_SUCCESS or OBJC_SYNC_NOT_OWNING_THREAD_ERROR
三.示例
|
|