#include <security_utilities/cfclass.h>
#include <security_utilities/errors.h>
#include <security_utilities/debugging.h>
+#include <os/lock.h>
#include <list>
#include <security_utilities/globalizer.h>
// SecCFObject
//
SecCFObject *
-SecCFObject::optional(CFTypeRef cfTypeRef) throw()
+SecCFObject::optional(CFTypeRef cfTypeRef) _NOEXCEPT
{
if (!cfTypeRef)
return NULL;
}
void *
-SecCFObject::allocate(size_t size, const CFClass &cfclass) throw(std::bad_alloc)
+SecCFObject::allocate(size_t size, const CFClass &cfclass)
{
CFTypeRef p = _CFRuntimeCreateInstance(NULL, cfclass.typeID,
size + kAlignedRuntimeSize - sizeof(CFRuntimeBase), NULL);
}
void
-SecCFObject::operator delete(void *object) throw()
+SecCFObject::operator delete(void *object) _NOEXCEPT
{
CFTypeRef cfType = reinterpret_cast<CFTypeRef>(reinterpret_cast<const uint8_t *>(object) - kAlignedRuntimeSize);
SecCFObject::SecCFObject()
{
mRetainCount = 1;
- mRetainSpinLock = OS_SPINLOCK_INIT;
+ mRetainLock = OS_UNFAIR_LOCK_INIT;
}
uint32_t SecCFObject::updateRetainCount(intptr_t direction, uint32_t *oldCount)
{
- OSSpinLockLock(&mRetainSpinLock);
+ os_unfair_lock_lock(&mRetainLock);
if (oldCount != NULL)
{
uint32_t result = mRetainCount;
- OSSpinLockUnlock(&mRetainSpinLock);
+ os_unfair_lock_unlock(&mRetainLock);
return result;
}
}
CFTypeRef
-SecCFObject::handle(bool retain) throw()
+SecCFObject::handle(bool retain) _NOEXCEPT
{
CFTypeRef cfType = *this;
if (retain && !isNew()) CFRetain(cfType);