[PATCH] pthread_getattr_np, pthread_setschedprio

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Mon Apr 11 02:30:00 GMT 2011


This patch adds two pthread functions which appear to be "low-hanging
fruit".

pthread_setschedprio(3) is a POSIX function[1][2] which changes the
scheduling priority for the given thread.  It is similar to
pthread_setschedparam(3) but does not change the scheduling policy and
doesn't require the priority to be wrapped in a struct.

pthread_getattr_np(3) is a GNU extension[3] which initializes the given
pthread_attr_t with the actual attributes of the given thread.  While
the example code does not have the pthread_attr_t pre-initialized by
pthread_attr_init(3), I have seen real world code where it is, so either
possibility is handled.

This is my first contribution to the threading code, so I'd appreciate a
thorough double-check of my understanding of the specs and code.

Patch for winsup/cygwin attached.  As for winsup/doc/new-features.sgml,
should this be merged with the pthread spinlocks line item or kept
separate?

Yaakov


[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_setschedprio.html
[2] http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_setschedprio.3.html
[3] http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_getattr_np.3.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread_funcs.patch
Type: text/x-patch
Size: 5111 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110411/e962561a/attachment.bin>


More information about the Cygwin-patches mailing list