Add pthread_rwlockattr_init(3) and pthread_rwlockattr_destroy(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-09-03 23:33:07 +02:00
parent 466091bc4f
commit 978aa68906
4 changed files with 73 additions and 3 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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 <http://www.gnu.org/licenses/>.
pthread_rwlockattr_destroy.c++
Destroys a read-write lock attributes object.
*******************************************************************************/
#include <pthread.h>
extern "C" int pthread_rwlockattr_destroy(pthread_rwlockattr_t* /*attr*/)
{
return 0;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
pthread_rwlockattr_init.c++
Initialize a read-write lock attributes object.
*******************************************************************************/
#include <pthread.h>
#include <string.h>
extern "C" int pthread_rwlockattr_init(pthread_rwlockattr_t* attr)
{
memset(attr, 0, sizeof(*attr));
return 0;
}