~stewart/haildb/trunk

« back to all changes in this revision

Viewing changes to include/os0sync.ic

  • Committer: Stewart Smith
  • Date: 2010-04-09 07:57:43 UTC
  • Revision ID: stewart@flamingspork.com-20100409075743-jfh1oml3el1uouvh
Embedded InnoDB 1.0.0 released

2009-04-21      The InnoDB Team

        Embedded InnoDB 1.0.0 released

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
4
 
 
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.
 
8
 
 
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.
 
12
 
 
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., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/******************************************************
 
20
The interface to the operating system synchronization primitives.
 
21
 
 
22
Created 9/6/1995 Heikki Tuuri
 
23
*******************************************************/
 
24
 
 
25
#ifdef __WIN__
 
26
#include <winbase.h>
 
27
#else
 
28
#include <pthread.h>
 
29
#endif
 
30
 
 
31
/**************************************************************
 
32
Acquires ownership of a fast mutex. Currently in Windows this is the same
 
33
as os_fast_mutex_lock! */
 
34
UNIV_INLINE
 
35
ulint
 
36
os_fast_mutex_trylock(
 
37
/*==================*/
 
38
                                                /* out: 0 if success, != 0 if
 
39
                                                was reserved by another
 
40
                                                thread */
 
41
        os_fast_mutex_t*        fast_mutex)     /* in: mutex to acquire */
 
42
{
 
43
#ifdef __WIN__
 
44
        EnterCriticalSection(fast_mutex);
 
45
 
 
46
        return(0);
 
47
#else
 
48
        return((ulint) pthread_mutex_trylock(fast_mutex));
 
49
#endif
 
50
}