Ejemplo n.º 1
0
void
refcount_destroy_many(refcount_t *rc, uint64_t number)
{
	ASSERT(rc->rc_count == number);
	rc->rc_count = 0;
	lck_spin_destroy((lck_spin_t *)&rc->rc_spinlck[0], zfs_spinlock_group);
}
Ejemplo n.º 2
0
void
lck_spin_free(lck_spin_t *lck,
              lck_grp_t *grp)
{
    lck_spin_destroy(lck, grp);
    kfree((void *)lck, sizeof(lck_spin_t));
}
Ejemplo n.º 3
0
static inline void
slice_fini(slice_t *slice)
{
#ifdef SLICE_SPINLOCK
	lck_spin_destroy(slice->spinlock, bmalloc_lock_group);
#endif /* SLICE_SPINLOCK */
}
/**
 * Release a reference, destroy the thing if necessary.
 *
 * @param   pThis       The semaphore.
 */
DECLINLINE(void) rtR0SemEventMultiDarwinRelease(PRTSEMEVENTMULTIINTERNAL pThis)
{
    if (RT_UNLIKELY(ASMAtomicDecU32(&pThis->cRefs) == 0))
    {
        Assert(pThis->u32Magic != RTSEMEVENTMULTI_MAGIC);
        lck_spin_destroy(pThis->pSpinlock, g_pDarwinLockGroup);
        RTMemFree(pThis);
    }
}
Ejemplo n.º 5
0
/**
 * Called when the refcount reaches zero.
 */
static void rtSemMutexDarwinFree(PRTSEMMUTEXINTERNAL pThis)
{
    IPRT_DARWIN_SAVE_EFL_AC();

    lck_spin_unlock(pThis->pSpinlock);
    lck_spin_destroy(pThis->pSpinlock, g_pDarwinLockGroup);
    RTMemFree(pThis);

    IPRT_DARWIN_RESTORE_EFL_AC();
}
Ejemplo n.º 6
0
static void
slice_allocator_fini(slice_allocator_t *sa)
{
	slice_allocator_empty_list(sa, &sa->free);
	slice_allocator_empty_list(sa, &sa->partial);
	
#ifdef SLICE_ALLOCATOR_TRACK_FULL_SLABS
	slice_allocator_empty_list(sa, &sa->full);
#endif /* SLICE_ALLOCATOR_TRACK_FULL_SLABS */
	
	list_destroy(&sa->free);
	list_destroy(&sa->partial);
#ifdef SLICE_ALLOCATOR_TRACK_FULL_SLABS
	list_destroy(&sa->full);
#endif /* SLICE_ALLOCATOR_TRACK_FULL_SLABS */
	
	/* Destroy spinlock */
	lck_spin_destroy(sa->spinlock, bmalloc_lock_group);
}
RTDECL(int)  RTSpinlockDestroy(RTSPINLOCK Spinlock)
{
    /*
     * Validate input.
     */
    PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;
    if (!pThis)
        return VERR_INVALID_PARAMETER;
    AssertMsgReturn(pThis->u32Magic == RTSPINLOCK_MAGIC,
                    ("Invalid spinlock %p magic=%#x\n", pThis, pThis->u32Magic),
                    VERR_INVALID_PARAMETER);

    /*
     * Make the lock invalid and release the memory.
     */
    ASMAtomicIncU32(&pThis->u32Magic);

    Assert(g_pDarwinLockGroup);
    lck_spin_destroy(pThis->pSpinLock, g_pDarwinLockGroup);
    pThis->pSpinLock = NULL;

    RTMemFree(pThis);
    return VINF_SUCCESS;
}
/**
 * Called when the refcount reaches zero.
 */
static void rtSemMutexDarwinFree(PRTSEMMUTEXINTERNAL pThis)
{
    lck_spin_unlock(pThis->pSpinlock);
    lck_spin_destroy(pThis->pSpinlock, g_pDarwinLockGroup);
    RTMemFree(pThis);
}
Ejemplo n.º 9
0
void
refcount_destroy(refcount_t *rc)
{
	rc->rc_count = 0;
	lck_spin_destroy((lck_spin_t *)&rc->rc_spinlck[0], zfs_spinlock_group);
}