From 978aa68906657673c76d839def0037f91316d2ba Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Tue, 3 Sep 2013 23:33:07 +0200 Subject: [PATCH] Add pthread_rwlockattr_init(3) and pthread_rwlockattr_destroy(3). --- libpthread/include/__/pthread.h | 10 ++++++- libpthread/include/pthread.h | 4 +-- libpthread/pthread_rwlockattr_destroy.c++ | 30 +++++++++++++++++++++ libpthread/pthread_rwlockattr_init.c++ | 32 +++++++++++++++++++++++ 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 libpthread/pthread_rwlockattr_destroy.c++ create mode 100644 libpthread/pthread_rwlockattr_init.c++ diff --git a/libpthread/include/__/pthread.h b/libpthread/include/__/pthread.h index 1944c18e..83638622 100644 --- a/libpthread/include/__/pthread.h +++ b/libpthread/include/__/pthread.h @@ -125,7 +125,15 @@ typedef struct } __pthread_rwlock_t; #endif -typedef int __pthread_rwlockattr_t; +#if defined(__is_sortix_libpthread) +typedef struct +{ +} __pthread_rwlockattr_t; +#else +typedef struct +{ +} __pthread_rwlockattr_t; +#endif typedef int __pthread_spinlock_t; diff --git a/libpthread/include/pthread.h b/libpthread/include/pthread.h index bd7f5d61..fbd3f081 100644 --- a/libpthread/include/pthread.h +++ b/libpthread/include/pthread.h @@ -250,9 +250,9 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t*); int pthread_rwlock_trywrlock(pthread_rwlock_t*); int pthread_rwlock_unlock(pthread_rwlock_t*); int pthread_rwlock_wrlock(pthread_rwlock_t*); -/* TODO: pthread_rwlockattr_destroy */ +int pthread_rwlockattr_destroy(pthread_rwlockattr_t*); /* TODO: pthread_rwlockattr_getpshared */ -/* TODO: pthread_rwlockattr_init */ +int pthread_rwlockattr_init(pthread_rwlockattr_t*); /* TODO: pthread_rwlockattr_setpshared */ pthread_t pthread_self(void); /* TODO: pthread_setcancelstate */ diff --git a/libpthread/pthread_rwlockattr_destroy.c++ b/libpthread/pthread_rwlockattr_destroy.c++ new file mode 100644 index 00000000..77038121 --- /dev/null +++ b/libpthread/pthread_rwlockattr_destroy.c++ @@ -0,0 +1,30 @@ +/******************************************************************************* + + Copyright(C) Jonas 'Sortie' Termansen 2013. + + This file is part of Sortix libpthread. + + Sortix libpthread is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + Sortix libpthread is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Sortix libpthread. If not, see . + + pthread_rwlockattr_destroy.c++ + Destroys a read-write lock attributes object. + +*******************************************************************************/ + +#include + +extern "C" int pthread_rwlockattr_destroy(pthread_rwlockattr_t* /*attr*/) +{ + return 0; +} diff --git a/libpthread/pthread_rwlockattr_init.c++ b/libpthread/pthread_rwlockattr_init.c++ new file mode 100644 index 00000000..ec5072d2 --- /dev/null +++ b/libpthread/pthread_rwlockattr_init.c++ @@ -0,0 +1,32 @@ +/******************************************************************************* + + Copyright(C) Jonas 'Sortie' Termansen 2013. + + This file is part of Sortix libpthread. + + Sortix libpthread is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + Sortix libpthread is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Sortix libpthread. If not, see . + + pthread_rwlockattr_init.c++ + Initialize a read-write lock attributes object. + +*******************************************************************************/ + +#include +#include + +extern "C" int pthread_rwlockattr_init(pthread_rwlockattr_t* attr) +{ + memset(attr, 0, sizeof(*attr)); + return 0; +}