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.
34
@return 0 if success, != 0 if was reserved by another thread */
37
os_fast_mutex_trylock(
38
/*==================*/
39
os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */
42
if (TryEnterCriticalSection(fast_mutex)) {
50
/* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock
51
so that it returns 0 on success. In the operating system
52
libraries, HP-UX-10.20 follows the old Posix 1003.4a Draft 4 and
53
returns 1 on success (but MySQL remaps that to 0), while Linux,
54
FreeBSD, Solaris, AIX, Tru64 Unix, HP-UX-11.0 return 0 on success. */
56
return((ulint) pthread_mutex_trylock(fast_mutex));