/[hurd]/hurd/libpthread/sysdeps/generic/pt-rwlock-init.c
ViewVC logotype

Diff of /hurd/libpthread/sysdeps/generic/pt-rwlock-init.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by neal, Thu Oct 10 23:05:06 2002 UTC revision 1.2 by neal, Thu May 12 20:55:38 2005 UTC
# Line 1  Line 1 
1  /* Initialize a rwlock.  Generic version.  /* Initialize a rwlock.  Generic version.
2     Copyright (C) 2002 Free Software Foundation, Inc.     Copyright (C) 2002, 2005 Free Software Foundation, Inc.
3     This file is part of the GNU C Library.     This file is part of the GNU C Library.
4    
5     The GNU C Library is free software; you can redistribute it and/or     The GNU C Library is free software; you can redistribute it and/or
# Line 18  Line 18 
18     Boston, MA 02111-1307, USA.  */     Boston, MA 02111-1307, USA.  */
19    
20  #include <pthread.h>  #include <pthread.h>
21    #include <string.h>
22  #include <pt-internal.h>  #include <pt-internal.h>
23    
24  int  int
25  _pthread_rwlock_init (pthread_rwlock_t *rwlock,  _pthread_rwlock_init (pthread_rwlock_t *rwlock,
26                        const pthread_rwlockattr_t *attr)                        const pthread_rwlockattr_t *attr)
27  {  {
28    *rwlock = __PTHREAD_RWLOCK_INITIALIZER;    *rwlock = (pthread_rwlock_t) __PTHREAD_RWLOCK_INITIALIZER;
29    
30      if (! attr
31          || memcmp (attr, &__pthread_default_rwlockattr, sizeof (*attr) == 0))
32        /* Use the default attributes.  */
33        return 0;
34    
35      /* Non-default attributes.  */
36    
37      rwlock->__attr = malloc (sizeof *attr);
38      if (! rwlock->__attr)
39        return ENOMEM;
40    
41      *rwlock->__attr = *attr;
42    return 0;    return 0;
43  }  }
44    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26