1219019Sgabor/* $FreeBSD$ */ 2219019Sgabor/*- 3219019Sgabor * Copyright (C) 2010 Gabor Kovesdan <gabor@FreeBSD.org> 4219019Sgabor * All rights reserved. 5219019Sgabor * 6219019Sgabor * Redistribution and use in source and binary forms, with or without 7219019Sgabor * modification, are permitted provided that the following conditions 8219019Sgabor * are met: 9219019Sgabor * 1. Redistributions of source code must retain the above copyright 10219019Sgabor * notice, this list of conditions and the following disclaimer. 11219019Sgabor * 2. Redistributions in binary form must reproduce the above copyright 12219019Sgabor * notice, this list of conditions and the following disclaimer in the 13219019Sgabor * documentation and/or other materials provided with the distribution. 14219019Sgabor * 15219019Sgabor * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16219019Sgabor * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17219019Sgabor * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18219019Sgabor * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19219019Sgabor * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20219019Sgabor * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21219019Sgabor * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22219019Sgabor * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23219019Sgabor * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24219019Sgabor * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25219019Sgabor * SUCH DAMAGE. 26219019Sgabor */ 27219019Sgabor 28219019Sgabor#include <pthread.h> 29219019Sgabor 30252584Speter#define WLOCK(lock) if (__isthreaded) \ 31252584Speter pthread_rwlock_wrlock(lock); 32252584Speter#define UNLOCK(lock) if (__isthreaded) \ 33252584Speter pthread_rwlock_unlock(lock); 34