/[hurd]/hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c
ViewVC logotype

Diff of /hurd/libpthread/sysdeps/generic/pt-mutex-timedlock.c

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

revision 1.2 by neal, Mon Nov 18 22:20:58 2002 UTC revision 1.3 by neal, Thu May 12 20:55:38 2005 UTC
# Line 1  Line 1 
1  /* Lock a mutex with a timeout.  Generic version.  /* Lock a mutex with a timeout.  Generic version.
2     Copyright (C) 2000,02 Free Software Foundation, Inc.     Copyright (C) 2000, 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 24  Line 24 
24    
25  #define LOSE do { * (int *) 0 = 0; } while (1)  #define LOSE do { * (int *) 0 = 0; } while (1)
26    
 int  
 pthread_mutex_timedlock (struct __pthread_mutex *mutex,  
                          const struct timespec *abstime)  
 {  
   return __pthread_mutex_timedlock_internal (mutex, abstime);  
 }  
   
27  /* Try to lock MUTEX, block until *ABSTIME if it is already held.  As  /* Try to lock MUTEX, block until *ABSTIME if it is already held.  As
28     a GNU extension, if TIMESPEC is NULL then wait forever.  */     a GNU extension, if TIMESPEC is NULL then wait forever.  */
29  int  int
# Line 96  __pthread_mutex_timedlock_internal (stru Line 89  __pthread_mutex_timedlock_internal (stru
89          }          }
90      }      }
91    
92      if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000))
93        return EINVAL;
94    
95    /* Add ourselves to the queue.  */    /* Add ourselves to the queue.  */
96    __pthread_enqueue (&mutex->__queue, self);    __pthread_enqueue (&mutex->__queue, self);
97    __pthread_spin_unlock (&mutex->__lock);    __pthread_spin_unlock (&mutex->__lock);
# Line 146  __pthread_mutex_timedlock_internal (stru Line 142  __pthread_mutex_timedlock_internal (stru
142    
143    return 0;    return 0;
144  }  }
145    
146    int
147    pthread_mutex_timedlock (struct __pthread_mutex *mutex,
148                             const struct timespec *abstime)
149    {
150      return __pthread_mutex_timedlock_internal (mutex, abstime);
151    }

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

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