/** * dso.c * * Copyright (C) 2005 - 2008 Bojan Smojver, Rexursive * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 2.1 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "private.h" /* DSO utility functions */ apr_status_t rxv_spin_dso_load(rxv_spin_ctx_t *ctx,const char *path, apr_dso_handle_t **handle){ if(!(ctx && ctx->priv && path)) return APR_EGENERAL; rxv_spin_lock(ctx->priv); if(!(*handle=apr_hash_get(ctx->priv->dso,path,APR_HASH_KEY_STRING))){ apr_status_t rv; apr_pool_t *pool=ctx->priv->pool; /* no luck, load new one */ if((rv=apr_dso_load(handle,path,pool))!=APR_SUCCESS && rv!=APR_EINIT){ rxv_spin_unlock(ctx->priv); return rv; } apr_hash_set(ctx->priv->dso, apr_pstrdup(pool,path),APR_HASH_KEY_STRING,*handle); } rxv_spin_unlock(ctx->priv); return APR_SUCCESS; }