Add pthread_attr_init(3) and pthread_attr_destroy(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-09-03 15:06:16 +02:00
parent dc44b65d01
commit e3eba51a94
5 changed files with 75 additions and 3 deletions

View File

@ -11,6 +11,8 @@ CPPFLAGS:=$(CPPFLAGS) -D__is_sortix_libpthread -I include
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
OBJS=\
pthread_attr_destroy.o \
pthread_attr_init.o \
pthread_condattr_destroy.o \
pthread_condattr_getclock.o \
pthread_condattr_init.o \

View File

@ -33,7 +33,15 @@ __BEGIN_DECLS
#define __sortix_libpthread__ 1
typedef int __pthread_attr_t;
#if defined(__is_sortix_libpthread)
typedef struct
{
} __pthread_attr_t;
#else
typedef struct
{
} __pthread_attr_t;
#endif
typedef int __pthread_barrier_t;

View File

@ -185,7 +185,7 @@ struct pthread* pthread_allocate_tls(void);
#endif
/* TODO: pthread_atfork */
/* TODO: pthread_attr_destroy */
int pthread_attr_destroy(pthread_attr_t*);
/* TODO: pthread_attr_getdetachstate */
/* TODO: pthread_attr_getguardsize */
/* TODO: pthread_attr_getinheritsched */
@ -194,7 +194,7 @@ struct pthread* pthread_allocate_tls(void);
/* TODO: pthread_attr_getscope */
/* TODO: pthread_attr_getstack */
/* TODO: pthread_attr_getstacksize */
/* TODO: pthread_attr_init */
int pthread_attr_init(pthread_attr_t*);
/* TODO: pthread_attr_setdetachstate */
/* TODO: pthread_attr_setguardsize */
/* TODO: pthread_attr_setinheritsched */

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_attr_destroy.c++
Destroys a thread attributes object.
*******************************************************************************/
#include <pthread.h>
extern "C" int pthread_attr_destroy(pthread_attr_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_attr_init.c++
Initialize a thread attributes object.
*******************************************************************************/
#include <pthread.h>
#include <string.h>
extern "C" int pthread_attr_init(pthread_attr_t* attr)
{
memset(attr, 0, sizeof(*attr));
return 0;
}