This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] pthread_yield


pthread_yield(3) was part of the POSIX.1c drafts but never made it into
the final standard.  Nevertheless, it is provided by Linux[1],
FreeBSD[2], OpenBSD[3], AIX[4], and possibly other *NIXes.  

"On Linux, this function is implemented as a call to sched_yield(2)."
Patch attached.


Yaakov


[1] http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_yield.3.html
[2] http://www.freebsd.org/cgi/man.cgi?query=pthread_yield
[3] http://www.openbsd.org/cgi-bin/man.cgi?query=pthread_yield
[4] http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/pthread_yield.htm

2011-02-09  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>

	* cygwin.din (pthread_yield): Export as alias to sched_yield.
	* include/pthread.h (pthread_yield): Declare.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* posix.sgml (std-deprec): Add pthread_yield.

Index: cygwin.din
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.229
diff -u -r1.229 cygwin.din
--- cygwin.din	13 Jan 2011 13:48:12 -0000	1.229
+++ cygwin.din	10 Feb 2011 03:11:52 -0000
@@ -1245,6 +1245,7 @@
 pthread_sigmask SIGFE
 pthread_suspend SIGFE
 pthread_testcancel SIGFE
+pthread_yield = sched_yield SIGFE
 ptsname SIGFE
 putc SIGFE
 _putc = putc SIGFE
Index: include/pthread.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/pthread.h,v
retrieving revision 1.26
diff -u -r1.26 pthread.h
--- include/pthread.h	7 Feb 2007 17:22:40 -0000	1.26
+++ include/pthread.h	10 Feb 2011 03:11:53 -0000
@@ -194,6 +194,7 @@
 
 int pthread_suspend (pthread_t);
 int pthread_continue (pthread_t);
+int pthread_yield (void);
 
 #ifdef __cplusplus
 }
Index: include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.332
diff -u -r1.332 version.h
--- include/cygwin/version.h	12 Jan 2011 13:01:43 -0000	1.332
+++ include/cygwin/version.h	10 Feb 2011 03:11:53 -0000
@@ -399,12 +399,13 @@
       233: Add TIOCGPGRP, TIOCSPGRP.  Export llround, llroundf.
       234: Export program_invocation_name, program_invocation_short_name.
       235: Export madvise.
+      236: Export pthread_yield.
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 235
+#define CYGWIN_VERSION_API_MINOR 236
 
      /* There is also a compatibity version number associated with the
 	shared memory regions.  It is incremented when incompatible
Index: posix.sgml
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/posix.sgml,v
retrieving revision 1.52
diff -u -r1.52 posix.sgml
--- posix.sgml	12 Jan 2011 13:09:31 -0000	1.52
+++ posix.sgml	10 Feb 2011 05:13:45 -0000
@@ -1225,6 +1225,7 @@
     pthread_continue		(XPG2)
     pthread_getsequence_np	(Tru64)
     pthread_suspend		(XPG2)
+    pthread_yield		(POSIX.1c drafts)
     pututline			(XPG2)
     putw			(SVID)
     rindex			(SUSv3)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]