Add pthread_cond_init(3) and pthread_cond_destroy(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-09-03 15:36:33 +02:00
parent 01acc81524
commit 5a96d0252f
4 changed files with 68 additions and 2 deletions

View File

@ -12,6 +12,8 @@ CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
OBJS=\
pthread_cond_broadcast.o \
pthread_cond_destroy.o \
pthread_cond_init.o \
pthread_cond_signal.o \
pthread_cond_timedwait.o \
pthread_cond_wait.o \

View File

@ -189,8 +189,9 @@ void pthread_initialize(void);
/* TODO: pthread_cleanup_pop */
/* TODO: pthread_cleanup_push */
int pthread_cond_broadcast(pthread_cond_t*);
/* TODO: pthread_cond_destroy */
/* TODO: pthread_cond_init */
int pthread_cond_destroy(pthread_cond_t*);
int pthread_cond_init(pthread_cond_t* __restrict,
const pthread_condattr_t* __restrict);
int pthread_cond_signal(pthread_cond_t*);
int pthread_cond_timedwait(pthread_cond_t* __restrict,
pthread_mutex_t* __restrict,

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_cond_destroy.c++
Destroys a condition variable.
*******************************************************************************/
#include <pthread.h>
extern "C" int pthread_cond_destroy(pthread_cond_t* restrict /*cond*/)
{
return 0;
}

View File

@ -0,0 +1,33 @@
/*******************************************************************************
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_cond_init.c++
Initializes a condition variable.
*******************************************************************************/
#include <pthread.h>
extern "C"
int pthread_cond_init(pthread_cond_t* restrict cond,
const pthread_condattr_t* restrict /*attr*/)
{
*cond = PTHREAD_COND_INITIALIZER;
return 0;
}