diff options
| author | 2011-12-21 23:59:03 +0000 | |
|---|---|---|
| committer | 2011-12-21 23:59:03 +0000 | |
| commit | 71f897f13f693a4447a98b5e0aec10e33b61a6ea (patch) | |
| tree | 5061e11446ba464e05a06dcb74d3dd7c571d2463 /lib/librthread/rthread_rwlockattr.c | |
| parent | regen (diff) | |
| download | wireguard-openbsd-71f897f13f693a4447a98b5e0aec10e33b61a6ea.tar.xz wireguard-openbsd-71f897f13f693a4447a98b5e0aec10e33b61a6ea.zip | |
Split out the pthread_rwlock* and pthread_once() functions from rthread_sync.c
to new files rthread_rwlock.c, rthread_rwlockattr.c, and rthread_once.c
Diffstat (limited to 'lib/librthread/rthread_rwlockattr.c')
| -rw-r--r-- | lib/librthread/rthread_rwlockattr.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/librthread/rthread_rwlockattr.c b/lib/librthread/rthread_rwlockattr.c new file mode 100644 index 00000000000..2c611758ce9 --- /dev/null +++ b/lib/librthread/rthread_rwlockattr.c @@ -0,0 +1,51 @@ +/* $OpenBSD: rthread_rwlockattr.c,v 1.1 2011/12/21 23:59:03 guenther Exp $ */ +/* + * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> + * All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* + * rwlock attributes + */ + + +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> + +#include <pthread.h> + +#include "rthread.h" + +int +pthread_rwlockattr_init(pthread_rwlockattr_t *attrp) +{ + pthread_rwlockattr_t attr; + + attr = calloc(1, sizeof(*attr)); + if (!attr) + return (errno); + *attrp = attr; + + return (0); +} + +int +pthread_rwlockattr_destroy(pthread_rwlockattr_t *attrp) +{ + free(*attrp); + *attrp = NULL; + + return (0); +} |
