diff --git a/libpthread/Makefile b/libpthread/Makefile index a3d81e12..c7029c1b 100644 --- a/libpthread/Makefile +++ b/libpthread/Makefile @@ -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 \ diff --git a/libpthread/include/__/pthread.h b/libpthread/include/__/pthread.h index 85ebafb4..8554dd5f 100644 --- a/libpthread/include/__/pthread.h +++ b/libpthread/include/__/pthread.h @@ -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; diff --git a/libpthread/include/pthread.h b/libpthread/include/pthread.h index 0c62461d..1d507dde 100644 --- a/libpthread/include/pthread.h +++ b/libpthread/include/pthread.h @@ -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 */ diff --git a/libpthread/pthread_attr_destroy.c++ b/libpthread/pthread_attr_destroy.c++ new file mode 100644 index 00000000..f5e17945 --- /dev/null +++ b/libpthread/pthread_attr_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_attr_destroy.c++ + Destroys a thread attributes object. + +*******************************************************************************/ + +#include + +extern "C" int pthread_attr_destroy(pthread_attr_t* /*attr*/) +{ + return 0; +} diff --git a/libpthread/pthread_attr_init.c++ b/libpthread/pthread_attr_init.c++ new file mode 100644 index 00000000..5634f273 --- /dev/null +++ b/libpthread/pthread_attr_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_attr_init.c++ + Initialize a thread attributes object. + +*******************************************************************************/ + +#include +#include + +extern "C" int pthread_attr_init(pthread_attr_t* attr) +{ + memset(attr, 0, sizeof(*attr)); + return 0; +}