From d4d74c5f56d312885acf59ce0981994eef8e3dba Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 19 May 2010 08:32:16 +0200 Subject: Add pthread_yield function * pthread/pt-yield.c: New file. * Makefile (SRCS): Add pt-yield.c * Makefile.am (libpthread_a_SOURCES): Add pt-yield.c --- include/pthread/pthread.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/pthread/pthread.h') diff --git a/include/pthread/pthread.h b/include/pthread/pthread.h index fbe3294..e6b9249 100644 --- a/include/pthread/pthread.h +++ b/include/pthread/pthread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008, 2009 +/* Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -734,6 +734,14 @@ extern int pthread_setschedparam (pthread_t thread, int policy, /* Set thread THREAD's scheduling priority. */ extern int pthread_setschedprio (pthread_t thread, int prio); + +#ifdef __USE_GNU +/* Yield the processor to another thread or process. + This function is similar to the POSIX `sched_yield' function but + might be differently implemented in the case of a m-on-n thread + implementation. */ +extern int pthread_yield (void); +#endif /* Kernel-specific interfaces. */ -- cgit v1.2.3 From c2a1b325b7b2ce0d3d16bd1e9430e1d7eddce71e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 23 Aug 2011 19:06:18 +0200 Subject: Use __clockid_t instead of clockid_t Using clockid_t just for pthread types makes us pull , which defines time(), which may conflict with applications. * include/pthread/pthread.h (pthread_condattr_getclock, pthread_condattr_setclock, pthread_getcpuclockid): Use __clockid_t instead of clockid_t. * include/pthread/pthreadtypes.h: Include , instead of and defining clockid_t ourself when not defined by time.h. * sysdeps/generic/bits/condition-attr.h: Include instead of . (__pthread_condattr): Use __clockid_t instead of clockid_t. --- include/pthread/pthread.h | 6 +++--- include/pthread/pthreadtypes.h | 13 +------------ sysdeps/generic/bits/condition-attr.h | 4 ++-- 3 files changed, 6 insertions(+), 17 deletions(-) (limited to 'include/pthread/pthread.h') diff --git a/include/pthread/pthread.h b/include/pthread/pthread.h index e6b9249..67b8fe4 100644 --- a/include/pthread/pthread.h +++ b/include/pthread/pthread.h @@ -377,11 +377,11 @@ extern int pthread_condattr_destroy (pthread_condattr_t *attr); #ifdef __USE_XOPEN2K /* Return the value of the clock attribute in *ATTR in *CLOCK_ID. */ extern int pthread_condattr_getclock (const pthread_condattr_t *__restrict attr, - clockid_t *__restrict clock_id); + __clockid_t *__restrict clock_id); /* Set the value of the clock attribute in *ATTR to CLOCK_ID. */ extern int pthread_condattr_setclock (pthread_condattr_t *attr, - clockid_t clock_id); + __clockid_t clock_id); #endif @@ -718,7 +718,7 @@ extern int pthread_kill (pthread_t thread, int signo); #ifdef __USE_XOPEN2K /* Return the thread cpu clock. */ -extern int pthread_getcpuclockid (pthread_t thread, clockid_t *clock); +extern int pthread_getcpuclockid (pthread_t thread, __clockid_t *clock); #endif diff --git a/include/pthread/pthreadtypes.h b/include/pthread/pthreadtypes.h index 471e08e..33bd009 100644 --- a/include/pthread/pthreadtypes.h +++ b/include/pthread/pthreadtypes.h @@ -25,18 +25,7 @@ #include -#define __need_clockid_t -#include - -/* If we are in a mode where clockid_t is not automatically defined - and another header has already included then defining - __need_clockid_t was not enough. */ -#ifndef __clockid_t_defined -# define __clockid_t_defined 1 -# include -/* Clock ID used in clock and timer functions. */ -typedef __clockid_t clockid_t; -#endif +#include __BEGIN_DECLS diff --git a/sysdeps/generic/bits/condition-attr.h b/sysdeps/generic/bits/condition-attr.h index a131128..4cd4e8c 100644 --- a/sysdeps/generic/bits/condition-attr.h +++ b/sysdeps/generic/bits/condition-attr.h @@ -20,7 +20,7 @@ #ifndef _BITS_CONDITION_ATTR_H #define _BITS_CONDITION_ATTR_H 1 -#include +#include enum __pthread_process_shared; @@ -28,7 +28,7 @@ enum __pthread_process_shared; struct __pthread_condattr { enum __pthread_process_shared pshared; - clockid_t clock; + __clockid_t clock; }; #endif /* bits/condition.h */ -- cgit v1.2.3