1
/*****************************************************************************
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/os0sync.ic
21
The interface to the operating system synchronization primitives.
23
Created 9/6/1995 Heikki Tuuri
24
*******************************************************/
32
/**********************************************************//**
33
Acquires ownership of a fast mutex. Currently in Windows this is the same
34
as os_fast_mutex_lock!
35
@return 0 if success, != 0 if was reserved by another thread */
38
os_fast_mutex_trylock(
39
/*==================*/
40
os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */
43
EnterCriticalSection(fast_mutex);
47
/* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock
48
so that it returns 0 on success. In the operating system
49
libraries, HP-UX-10.20 follows the old Posix 1003.4a Draft 4 and
50
returns 1 on success (but MySQL remaps that to 0), while Linux,
51
FreeBSD, Solaris, AIX, Tru64 Unix, HP-UX-11.0 return 0 on success. */
53
return((ulint) pthread_mutex_trylock(fast_mutex));