~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/ndb/src/common/portlib/NdbMutex.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2003 MySQL AB
 
1
/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
15
15
 
16
16
 
17
17
#include <ndb_global.h>
24
24
{
25
25
  NdbMutex* pNdbMutex;
26
26
  int result;
27
 
  DBUG_ENTER("NdbMutex_Create");
28
 
  
 
27
 
29
28
  pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex));
30
 
  DBUG_PRINT("info",("NdbMem_Allocate 0x%lx", (long) pNdbMutex));
31
 
  
 
29
 
32
30
  if (pNdbMutex == NULL)
33
 
    DBUG_RETURN(NULL);
34
 
  
 
31
    return NULL;
 
32
 
35
33
  result = pthread_mutex_init(pNdbMutex, NULL);
36
34
  assert(result == 0);
37
 
                             
38
 
  DBUG_RETURN(pNdbMutex);                    
 
35
 
 
36
  return pNdbMutex;
39
37
}
40
38
 
41
39
 
42
40
int NdbMutex_Destroy(NdbMutex* p_mutex)
43
41
{
44
42
  int result;
45
 
  DBUG_ENTER("NdbMutex_Destroy");
46
43
 
47
44
  if (p_mutex == NULL)
48
 
    DBUG_RETURN(-1);
 
45
    return -1;
49
46
 
50
47
  result = pthread_mutex_destroy(p_mutex);
51
48
 
52
 
  DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex));
53
49
  NdbMem_Free(p_mutex);
54
 
                             
55
 
  DBUG_RETURN(result);
56
50
 
 
51
  return result;
57
52
}
58
53
 
59
54