Esempio n. 1
0
KineticStatus KineticSession_Destroy(KineticSession * const session)
{
    if (session == NULL) {
        return KINETIC_STATUS_SESSION_EMPTY;
    }
    KineticCountingSemaphore_Destroy(session->outstandingOperations);
    KineticAllocator_FreeSession(session);

    return KINETIC_STATUS_SUCCESS;
}
void test_kinetic_countingsemaphore_should_be_thread_safe(void)
{
    KineticCountingSemaphore* sem = KineticCountingSemaphore_Create(3);

    KineticCountingSemaphore_Take(sem);
    KineticCountingSemaphore_Take(sem);
    KineticCountingSemaphore_Take(sem);
    KineticCountingSemaphore_Give(sem);
    KineticCountingSemaphore_Give(sem);
    KineticCountingSemaphore_Take(sem);
    KineticCountingSemaphore_Give(sem);
    KineticCountingSemaphore_Give(sem);

    KineticCountingSemaphore_Destroy(sem);
}