示例#1
0
APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock)
{
    apr_status_t stat;
    if ((stat = thread_rwlock_cleanup(rwlock)) == APR_SUCCESS) {
        apr_pool_cleanup_kill(rwlock->pool, rwlock, thread_rwlock_cleanup);
        return APR_SUCCESS;
    }
    return stat;
}
示例#2
0
APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
                                                   apr_pool_t *pool)
{
    apr_thread_rwlock_t *new_rwlock;
    apr_status_t stat;

    new_rwlock = (apr_thread_rwlock_t *)apr_pcalloc(pool,
                                                  sizeof(apr_thread_rwlock_t));

    if (new_rwlock == NULL) {
        return APR_ENOMEM;
    }

    new_rwlock->pool = pool;
    new_rwlock->rwlock = (pthread_rwlock_t *)apr_palloc(pool, 
                                                     sizeof(pthread_rwlock_t));

    if (new_rwlock->rwlock == NULL) {
        return APR_ENOMEM;
    }

    if ((stat = pthread_rwlock_init(new_rwlock->rwlock, NULL))) {
#ifdef PTHREAD_SETS_ERRNO
        stat = errno;
#endif
        thread_rwlock_cleanup(new_rwlock);
        return stat;
    }

    apr_pool_cleanup_register(new_rwlock->pool,
                              (void *)new_rwlock, thread_rwlock_cleanup,
                              apr_pool_cleanup_null);

    *rwlock = new_rwlock;
    return APR_SUCCESS;
}
示例#3
0
ce_int_t 
ce_thread_rwlock_destroy(ce_thread_rwlock_t *rwlock)
{
    return thread_rwlock_cleanup(rwlock);
}