Add pthread_condattr_init(3) and pthread_condattr_destroy(3).
This commit is contained in:
parent
5a96d0252f
commit
dffcc700d1
|
@ -11,6 +11,8 @@ CPPFLAGS:=$(CPPFLAGS) -D__is_sortix_libpthread -I include
|
||||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
OBJS=\
|
OBJS=\
|
||||||
|
pthread_condattr_destroy.o \
|
||||||
|
pthread_condattr_init.o \
|
||||||
pthread_cond_broadcast.o \
|
pthread_cond_broadcast.o \
|
||||||
pthread_cond_destroy.o \
|
pthread_cond_destroy.o \
|
||||||
pthread_cond_init.o \
|
pthread_cond_init.o \
|
||||||
|
|
|
@ -53,7 +53,15 @@ typedef struct
|
||||||
} __pthread_cond_t;
|
} __pthread_cond_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef int __pthread_condattr_t;
|
#if defined(__is_sortix_libpthread)
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
} __pthread_condattr_t;
|
||||||
|
#else
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
} __pthread_condattr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int __pthread_key_t;
|
typedef int __pthread_key_t;
|
||||||
|
|
||||||
|
|
|
@ -197,10 +197,10 @@ int pthread_cond_timedwait(pthread_cond_t* __restrict,
|
||||||
pthread_mutex_t* __restrict,
|
pthread_mutex_t* __restrict,
|
||||||
const struct timespec* __restrict);
|
const struct timespec* __restrict);
|
||||||
int pthread_cond_wait(pthread_cond_t* __restrict, pthread_mutex_t* __restrict);
|
int pthread_cond_wait(pthread_cond_t* __restrict, pthread_mutex_t* __restrict);
|
||||||
/* TODO: pthread_condattr_destroy */
|
int pthread_condattr_destroy(pthread_condattr_t*);
|
||||||
/* TODO: pthread_condattr_getclock */
|
/* TODO: pthread_condattr_getclock */
|
||||||
/* TODO: pthread_condattr_getpshared */
|
/* TODO: pthread_condattr_getpshared */
|
||||||
/* TODO: pthread_condattr_init */
|
int pthread_condattr_init(pthread_condattr_t*);
|
||||||
/* TODO: pthread_condattr_setclock */
|
/* TODO: pthread_condattr_setclock */
|
||||||
/* TODO: pthread_condattr_setpshared */
|
/* TODO: pthread_condattr_setpshared */
|
||||||
/* TODO: pthread_create */
|
/* TODO: pthread_create */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
Copyright(C) Jonas 'Sortie' Termansen 2013, 2014.
|
||||||
|
|
||||||
This file is part of Sortix libpthread.
|
This file is part of Sortix libpthread.
|
||||||
|
|
||||||
|
@ -26,8 +26,17 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
int pthread_cond_init(pthread_cond_t* restrict cond,
|
int pthread_cond_init(pthread_cond_t* restrict cond,
|
||||||
const pthread_condattr_t* restrict /*attr*/)
|
const pthread_condattr_t* restrict attr)
|
||||||
{
|
{
|
||||||
*cond = PTHREAD_COND_INITIALIZER;
|
pthread_condattr_t default_attr;
|
||||||
|
if ( !attr )
|
||||||
|
{
|
||||||
|
pthread_condattr_init(&default_attr);
|
||||||
|
attr = &default_attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
cond->first = NULL;
|
||||||
|
cond->last = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_condattr_destroy.c++
|
||||||
|
Destroys a condition variable attributes object.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
extern "C" int pthread_condattr_destroy(pthread_condattr_t* /*attr*/)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2013, 2014.
|
||||||
|
|
||||||
|
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_condattr_init.c++
|
||||||
|
Initialize a condition variable attributes object.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
extern "C" int pthread_condattr_init(pthread_condattr_t* attr)
|
||||||
|
{
|
||||||
|
memset(attr, 0, sizeof(*attr));
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue