/* * * This file is part of bufferpool * * Copyright (C) 2007 by LScube team * See AUTHORS for more details * * bufferpool 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. * * bufferpool 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 bufferpool; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * */ #include #include void bp_free(BPBuffer * buffer) { switch (buffer->type) { case buff_shm: bp_shm_unmap(buffer); bp_log(FNC_LOG_DEBUG, "Buffer in SHM unmapped \n"); break; case buff_local:{ pthread_mutex_destroy(&buffer->control->syn); free(buffer->control); free(buffer->slots); free(buffer); bp_log(FNC_LOG_DEBUG, "Buffer is freed \n"); break; } default: break; } }