1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Add pthread_mutexattr_init(3) and pthread_mutexattr_destroy(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-09-03 14:51:44 +02:00
parent b886c2297f
commit a8b5eb4268
5 changed files with 75 additions and 3 deletions

View file

@ -13,6 +13,8 @@ CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
OBJS=\ OBJS=\
pthread_equal.o \ pthread_equal.o \
pthread_initialize.o \ pthread_initialize.o \
pthread_mutexattr_destroy.o \
pthread_mutexattr_init.o \
pthread_mutex_destroy.o \ pthread_mutex_destroy.o \
pthread_mutex_init.o \ pthread_mutex_init.o \
pthread_mutex_lock.o \ pthread_mutex_lock.o \

View file

@ -63,7 +63,15 @@ typedef struct
} __pthread_mutex_t; } __pthread_mutex_t;
#endif #endif
typedef int __pthread_mutexattr_t; #if defined(__is_sortix_libpthread)
typedef struct
{
} __pthread_mutexattr_t;
#else
typedef struct
{
} __pthread_mutexattr_t;
#endif
typedef int __pthread_once_t; typedef int __pthread_once_t;

View file

@ -213,13 +213,13 @@ int pthread_mutex_lock(pthread_mutex_t*);
/* TODO: pthread_mutex_timedlock */ /* TODO: pthread_mutex_timedlock */
int pthread_mutex_trylock(pthread_mutex_t*); int pthread_mutex_trylock(pthread_mutex_t*);
int pthread_mutex_unlock(pthread_mutex_t*); int pthread_mutex_unlock(pthread_mutex_t*);
/* TODO: pthread_mutexattr_destroy */ int pthread_mutexattr_destroy(pthread_mutexattr_t*);
/* TODO: pthread_mutexattr_getprioceiling */ /* TODO: pthread_mutexattr_getprioceiling */
/* TODO: pthread_mutexattr_getprotocol */ /* TODO: pthread_mutexattr_getprotocol */
/* TODO: pthread_mutexattr_getpshared */ /* TODO: pthread_mutexattr_getpshared */
/* TODO: pthread_mutexattr_getrobust */ /* TODO: pthread_mutexattr_getrobust */
/* TODO: pthread_mutexattr_gettype */ /* TODO: pthread_mutexattr_gettype */
/* TODO: pthread_mutexattr_init */ int pthread_mutexattr_init(pthread_mutexattr_t*);
/* TODO: pthread_mutexattr_setprioceiling */ /* TODO: pthread_mutexattr_setprioceiling */
/* TODO: pthread_mutexattr_setprotocol */ /* TODO: pthread_mutexattr_setprotocol */
/* TODO: pthread_mutexattr_setpshared */ /* TODO: pthread_mutexattr_setpshared */

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_mutexattr_destroy.c++
Destroys a mutex attributes object.
*******************************************************************************/
#include <pthread.h>
extern "C" int pthread_mutexattr_destroy(pthread_mutexattr_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_mutexattr_init.c++
Initialize a mutex attributes object.
*******************************************************************************/
#include <pthread.h>
#include <string.h>
extern "C" int pthread_mutexattr_init(pthread_mutexattr_t* attr)
{
memset(attr, 0, sizeof(*attr));
return 0;
}