Add mutexattr_init(), mutexattr_destroy(), and mutexattr_settype() (recursive

mutexes are used by the X libraries).
This commit is contained in:
thorpej 2003-01-19 20:46:11 +00:00
parent 3d8d8663b9
commit 592409d356
3 changed files with 47 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: threadlib.h,v 1.1 2003/01/19 19:24:39 thorpej Exp $ */
/* $NetBSD: threadlib.h,v 1.2 2003/01/19 20:46:11 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 2003 The NetBSD Foundation, Inc.
@ -54,6 +54,10 @@
#define mutexattr_t pthread_mutexattr_t
#define MUTEX_TYPE_NORMAL PTHREAD_MUTEX_NORMAL
#define MUTEX_TYPE_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK
#define MUTEX_TYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
#define cond_t pthread_cond_t
#define COND_INITIALIZER PTHREAD_COND_INITIALIZER
@ -79,12 +83,20 @@ int __libc_mutex_trylock(mutex_t *);
int __libc_mutex_unlock(mutex_t *);
int __libc_mutex_destroy(mutex_t *);
int __libc_mutexattr_init(mutexattr_t *);
int __libc_mutexattr_settype(mutexattr_t *, int);
int __libc_mutexattr_destroy(mutexattr_t *);
#define mutex_init(m, a) __libc_mutex_init((m), (a))
#define mutex_lock(m) __libc_mutex_lock((m))
#define mutex_trylock(m) __libc_mutex_trylock((m))
#define mutex_unlock(m) __libc_mutex_unlock((m))
#define mutex_destroy(m) __libc_mutex_destroy((m))
#define mutexattr_init(ma) __libc_mutexattr_init((ma))
#define mutexattr_settype(ma, t) __libc_mutexattr_settype((ma), (t))
#define mutexattr_destroy(ma) __libc_mutexattr_destroy((ma))
int __libc_cond_init(cond_t *, const condattr_t *);
int __libc_cond_signal(cond_t *);
int __libc_cond_broadcast(cond_t *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: thread-stub.c,v 1.3 2003/01/19 19:48:45 thorpej Exp $ */
/* $NetBSD: thread-stub.c,v 1.4 2003/01/19 20:46:12 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -78,6 +78,13 @@ __weak_alias(__libc_mutex_trylock,__libc_mutex_catchall_stub)
__weak_alias(__libc_mutex_unlock,__libc_mutex_catchall_stub)
__weak_alias(__libc_mutex_destroy,__libc_mutex_catchall_stub)
int __libc_mutexattr_catchall_stub(mutexattr_t *);
int __libc_mutexattr_settype_stub(mutexattr_t *, int);
__weak_alias(__libc_mutexattr_init,__libc_mutexattr_catchall_stub)
__weak_alias(__libc_mutexattr_destroy,__libc_mutexattr_catchall_stub)
__weak_alias(__libc_mutexattr_settype,__libc_mutexattr_settype_stub)
int
__libc_mutex_init_stub(mutex_t *m, const mutexattr_t *a)
{
@ -102,6 +109,27 @@ __libc_mutex_catchall_stub(mutex_t *m)
return (0);
}
int
__libc_mutexattr_settype_stub(mutexattr_t *ma, int type)
{
/* LINTED deliberate lack of effect */
(void)ma;
/* LINTED deliberate lack of effect */
(void)type;
return (0);
}
int
__libc_mutexattr_catchall_stub(mutexattr_t *ma)
{
/* LINTED deliberate lack of effect */
(void)ma;
CHECK_NOT_THREADED();
return (0);
}
/* condition variables */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_mutex.c,v 1.3 2003/01/18 18:45:55 christos Exp $ */
/* $NetBSD: pthread_mutex.c,v 1.4 2003/01/19 20:46:12 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
@ -53,6 +53,10 @@ __strong_alias(__libc_mutex_trylock,pthread_mutex_trylock)
__strong_alias(__libc_mutex_unlock,pthread_mutex_unlock)
__strong_alias(__libc_mutex_destroy,pthread_mutex_destroy)
__strong_alias(__libc_mutexattr_init,pthread_mutexattr_init)
__strong_alias(__libc_mutexattr_destroy,pthread_mutexattr_destroy)
__string_alias(__libc_mutexattr_settype,pthread_mutexattr_settype)
__strong_alias(__libc_thr_once,pthread_once)
struct mutex_private {