From 6922362c66bbfaa3ac9b7bb6be24368d790d28d6 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 4 Jan 2002 04:53:36 +0000 Subject: * attr.c (pthread_attr_setscope): Add more error checking and actually store the scope value even though it's not really necessary. (pthread_attr_getscope): Return stored value. * implement.h (pthread_attr_t_): Add new scope element. * ANNOUNCE: Fix out of date comment next to pthread_attr_setscope in conformance section. --- ANNOUNCE | 19 ++++++++++++++++--- COPYING | 19 +++++++++++-------- ChangeLog | 10 ++++++++++ attr.c | 18 +++++++++++------- implement.h | 1 + 5 files changed, 49 insertions(+), 18 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 9953dc1..a6a84c5 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -27,10 +27,20 @@ announcement for the list of contributors. Changes since the last snapshot ------------------------------- +platform dependence +------------------- +As Win9x doesn't provide one, the library now contains +it's own InterlockedCompareExchange() routine. It is used to +implement spinlocks and barriers, and soon may be used in mutexes. +This routine relies on the CMPXCHG machine instruction which +is only available in i486 or above CPUs. This library +(from snapshot 20010712 onwards) therefore no longer runs on +i386 platforms. + rwlocks ------- Restored pthread_rwlock_wrlock() as a cancelation point as permitted -by POSIX 1003.1j. (Was prematurely disabled in the the last snapshot.) +by POSIX 1003.1j. (Was prematurely disabled in the last snapshot.) Bug fixes --------- @@ -39,6 +49,9 @@ pthread_mutexattr_getpshared, pthread_barrierattr_init, pthread_barrierattr_getpshared, and pthread_condattr_getpshared. - Scott McCaskill +Removed potential race condition in pthread_mutex_trylock and +pthread_mutex_lock; +- Alexander Terekhov --------------------------- Known bugs in this snapshot @@ -256,8 +269,8 @@ The following functions are implemented: pthread_setschedparam pthread_getconcurrency pthread_setconcurrency - pthread_attr_getscope (returns an error ENOSYS) - pthread_attr_setscope (returns an error ENOSYS) + pthread_attr_getscope + pthread_attr_setscope (only supports PTHREAD_SCOPE_SYSTEM) sched_get_priority_max (POSIX 1b) sched_get_priority_min (POSIX 1b) sched_rr_get_interval (POSIX 1b - returns an error ENOTSUP) diff --git a/COPYING b/COPYING index d54e44a..2a29a12 100644 --- a/COPYING +++ b/COPYING @@ -58,14 +58,17 @@ Pthreads-win32 copyrights and exception files is covered under the following GNU Lesser General Public License Copyrights: - Copyright (C) 1998 Ben Elliston and Ross Johnson - Copyright (C) 1999,2000,2001 Ross Johnson - - Please note that the names given in the Copyright above do not - imply authorship of the source code. The names of all - substantial contributors of intellectual works incorporated - in the pthreads-win32 distribution are listed in the file - CONTRIBUTORS. + Pthreads-win32 - POSIX Threads Library for Win32 + Copyright(C) 1998 John E. Bossom + Copyright(C) 1999,2002 Pthreads-win32 contributors + + The current list of contributors is contained + in the file CONTRIBUTORS included with the source + code distribution. The current list of CONTRIBUTORS + can also be seen at the following WWW location: + http://sources.redhat.com/pthreads-win32/contributors.html + + Contact Email: rpj@ise.canberra.edu.au These files are not covered under one of the Copyrights listed above: diff --git a/ChangeLog b/ChangeLog index 2f71846..e9604a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-01-04 Ross Johnson + + * attr.c (pthread_attr_setscope): Add more error + checking and actually store the scope value even + though it's not really necessary. + (pthread_attr_getscope): Return stored value. + * implement.h (pthread_attr_t_): Add new scope element. + * ANNOUNCE: Fix out of date comment next to + pthread_attr_setscope in conformance section. + 2001-12-21 Ross Johnson Contributed by - Alexander Terekhov diff --git a/attr.c b/attr.c index 44976e3..21c3ddb 100644 --- a/attr.c +++ b/attr.c @@ -360,6 +360,7 @@ pthread_attr_init(pthread_attr_t *attr) */ attr_result->param.sched_priority = THREAD_PRIORITY_NORMAL; attr_result->inheritsched = PTHREAD_EXPLICIT_SCHED; + attr_result->contentionscope = PTHREAD_SCOPE_SYSTEM; attr_result->valid = PTW32_ATTR_VALID; @@ -515,12 +516,15 @@ int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope) { #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - if (contentionscope != PTHREAD_SCOPE_SYSTEM) - { - return ENOTSUP; - } - - return 0; + switch (contentionscope) { + case PTHREAD_SCOPE_SYSTEM: + attr->contentionscope = contentionscope; + return 0; + case PTHREAD_SCOPE_PROCESS: + return ENOTSUP; + default: + return EINVAL; + } #else return ENOSYS; #endif @@ -531,7 +535,7 @@ int pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope) { #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - *contentionscope = PTHREAD_SCOPE_SYSTEM; + *contentionscope = attr->contentionscope; return 0; #else return ENOSYS; diff --git a/implement.h b/implement.h index 5eb46f4..3f2690e 100644 --- a/implement.h +++ b/implement.h @@ -127,6 +127,7 @@ struct pthread_attr_t_ { int detachstate; struct sched_param param; int inheritsched; + int contentionscope; #if HAVE_SIGSET_T sigset_t sigmask; #endif /* HAVE_SIGSET_T */ -- cgit v1.2.3