X-Git-Url: https://git.saurik.com/apple/objc4.git/blobdiff_plain/8972963c21fb120c80c09e06536ba4aa7eb98af3..6a2c2cfaf4bb7aa509c3cb14c3e863b13ff5e02d:/runtime/objc-arr.mm diff --git a/runtime/objc-arr.mm b/runtime/objc-arr.mm index 0bcd995..89a039e 100644 --- a/runtime/objc-arr.mm +++ b/runtime/objc-arr.mm @@ -130,6 +130,19 @@ public: new (&table_buf[i * SIDE_TABLE_SIZE]) SideTable; } } + + static bool noLocksHeld(void) { + bool gotAll = true; + for (int i = 0; i < SIDE_TABLE_STRIPE && gotAll; i++) { + SideTable *s = (SideTable *)(&table_buf[i * SIDE_TABLE_SIZE]); + if (OSSpinLockTry(&s->slock)) { + OSSpinLockUnlock(&s->slock); + } else { + gotAll = false; + } + } + return gotAll; + } }; STATIC_ASSERT(sizeof(SideTable) <= SIDE_TABLE_SIZE); @@ -142,6 +155,10 @@ SideTable::table_buf[SIDE_TABLE_STRIPE * SIDE_TABLE_SIZE]; // anonymous namespace }; +bool noSideTableLocksHeld(void) +{ + return SideTable::noLocksHeld(); +} // // The -fobjc-arr flag causes the compiler to issue calls to objc_{retain/release/autorelease/retain_block}