1 /*****************************************************************************
2 * $Id: thread.c,v 1.1.10.2 2008/12/18 18:02:31 johann Exp $
3 *****************************************************************************
4 * Copyright (C) 2003 The Regents of the University of California.
5 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
6 * Written by Chris Dunlap <cdunlap@llnl.gov>.
8 * This file is from LSD-Tools, the LLNL Software Development Toolbox.
10 * LSD-Tools is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
15 * LSD-Tools is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * You should have received a copy of the GNU General Public License along
21 * with LSD-Tools; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *****************************************************************************/
28 #endif /* HAVE_CONFIG_H */
39 lsd_mutex_is_locked (pthread_mutex_t *mutex)
41 /* Returns true if the mutex is locked; o/w, returns false.
45 assert (mutex != NULL);
46 rc = pthread_mutex_trylock (mutex);
47 return (rc == EBUSY ? 1 : 0);
50 #endif /* WITH_PTHREADS */