diff options
author | Thomas Schwinge <thomas@schwinge.name> | 2011-09-07 18:35:28 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@schwinge.name> | 2011-09-07 18:35:28 +0200 |
commit | f7e658d18210b2540708f9abf601b3a9f197341c (patch) | |
tree | e53cd538dcd3d014779aff85fbdc57dff97405c5 | |
parent | 5e7da0e119e508023f1dcb619a0ada77f8147daf (diff) | |
parent | d4d74c5f56d312885acf59ce0981994eef8e3dba (diff) |
Merge commit 'refs/top-bases/t/stand-alone' into t/stand-alone
Conflicts:
Makefile
Makefile.am
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | include/pthread/pthread.h | 10 | ||||
-rw-r--r-- | pthread/pt-yield.c | 26 |
3 files changed, 36 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index 5690795..3200aad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -197,6 +197,7 @@ SRCS := pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \ pt-getcpuclockid.c \ \ pt-getschedparam.c pt-setschedparam.c pt-setschedprio.c \ + pt-yield.c \ \ sem-close.c sem-destroy.c sem-getvalue.c sem-init.c sem-open.c \ sem-post.c sem-timedwait.c sem-trywait.c sem-unlink.c \ 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. */ diff --git a/pthread/pt-yield.c b/pthread/pt-yield.c new file mode 100644 index 0000000..27848bb --- /dev/null +++ b/pthread/pt-yield.c @@ -0,0 +1,26 @@ +/* Yield the processor to another thread or process. + Copyright (C) 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <pthread.h> +#include <sched.h> + +int pthread_yield(void) +{ + return sched_yield (); +} |