* include/pthread.h (PTHREAD_COND_INITIALIZER): Define.
* thread.cc (__pthread_cond_destroy): Add support for PTHREAD_COND_INITIALIZER. (__pthread_cond_init): Ditto. (__pthread_cond_broadcast): Ditto. (__pthread_cond_signal): Ditto. (__pthread_cond_dowait): Ditto. (__pthread_mutex_init): Handle PTHREAD_MUTEX_INITIALIZER correctly, don't return error when it's passed as parameter. * winsup.h (check_null_invalid_struct): Call correct function.
This commit is contained in:
parent
e2b3dc2580
commit
f38ac9b70c
|
@ -1,3 +1,16 @@
|
|||
2001-11-15 Egor Duda <deo@logos-m.ru>
|
||||
|
||||
* include/pthread.h (PTHREAD_COND_INITIALIZER): Define.
|
||||
* thread.cc (__pthread_cond_destroy): Add support for
|
||||
PTHREAD_COND_INITIALIZER.
|
||||
(__pthread_cond_init): Ditto.
|
||||
(__pthread_cond_broadcast): Ditto.
|
||||
(__pthread_cond_signal): Ditto.
|
||||
(__pthread_cond_dowait): Ditto.
|
||||
(__pthread_mutex_init): Handle PTHREAD_MUTEX_INITIALIZER correctly,
|
||||
don't return error when it's passed as parameter.
|
||||
* winsup.h (check_null_invalid_struct): Call correct function.
|
||||
|
||||
2001-11-14 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* exceptions.cc: Add stdlib.h include for alloca declaration.
|
||||
|
|
|
@ -43,7 +43,8 @@ extern "C"
|
|||
#define PTHREAD_CANCEL_DEFERRED 0
|
||||
#define PTHREAD_CANCEL_DISABLE 1
|
||||
#define PTHREAD_CANCELED
|
||||
#define PTHREAD_COND_INITIALIZER
|
||||
/* this should be a value that can never be a valid address */
|
||||
#define PTHREAD_COND_INITIALIZER (void *)21
|
||||
#define PTHREAD_CREATE_DETACHED 1
|
||||
/* the default : joinable */
|
||||
#define PTHREAD_CREATE_JOINABLE 0
|
||||
|
|
|
@ -1676,6 +1676,8 @@ __pthread_getspecific (pthread_key_t key)
|
|||
int
|
||||
__pthread_cond_destroy (pthread_cond_t *cond)
|
||||
{
|
||||
if (check_valid_pointer (cond) && (*cond == PTHREAD_COND_INITIALIZER))
|
||||
return 0;
|
||||
if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
|
||||
return EINVAL;
|
||||
|
||||
|
@ -1695,7 +1697,7 @@ __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr)
|
|||
if (attr && verifyable_object_isvalid (attr, PTHREAD_CONDATTR_MAGIC) != VALID_OBJECT)
|
||||
return EINVAL;
|
||||
|
||||
if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != INVALID_OBJECT)
|
||||
if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC, PTHREAD_COND_INITIALIZER) == VALID_OBJECT)
|
||||
return EBUSY;
|
||||
|
||||
*cond = new pthread_cond (attr ? (*attr) : NULL);
|
||||
|
@ -1713,6 +1715,8 @@ __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr)
|
|||
int
|
||||
__pthread_cond_broadcast (pthread_cond_t *cond)
|
||||
{
|
||||
if (*cond == PTHREAD_COND_INITIALIZER)
|
||||
__pthread_cond_init (cond, NULL);
|
||||
if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
|
||||
return EINVAL;
|
||||
|
||||
|
@ -1724,6 +1728,8 @@ __pthread_cond_broadcast (pthread_cond_t *cond)
|
|||
int
|
||||
__pthread_cond_signal (pthread_cond_t *cond)
|
||||
{
|
||||
if (*cond == PTHREAD_COND_INITIALIZER)
|
||||
__pthread_cond_init (cond, NULL);
|
||||
if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
|
||||
return EINVAL;
|
||||
|
||||
|
@ -1743,6 +1749,8 @@ __pthread_cond_dowait (pthread_cond_t *cond, pthread_mutex_t *mutex,
|
|||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
themutex = mutex;
|
||||
if (*cond == PTHREAD_COND_INITIALIZER)
|
||||
__pthread_cond_init (cond, NULL);
|
||||
|
||||
if (verifyable_object_isvalid (themutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
|
||||
return EINVAL;
|
||||
|
@ -1920,7 +1928,7 @@ __pthread_mutex_init (pthread_mutex_t *mutex,
|
|||
if (attr && verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT || check_valid_pointer (mutex))
|
||||
return EINVAL;
|
||||
|
||||
if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC, PTHREAD_MUTEX_INITIALIZER) != INVALID_OBJECT)
|
||||
if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC, PTHREAD_MUTEX_INITIALIZER) == VALID_OBJECT)
|
||||
return EBUSY;
|
||||
|
||||
*mutex = new pthread_mutex (attr ? (*attr) : NULL);
|
||||
|
|
|
@ -195,7 +195,7 @@ int __stdcall __check_null_invalid_struct_errno (const void *s, unsigned sz) __a
|
|||
int __stdcall __check_invalid_read_ptr_errno (const void *s, unsigned sz) __attribute__ ((regparm(2)));
|
||||
|
||||
#define check_null_invalid_struct(s) \
|
||||
__check_null_invalid ((s), sizeof (*(s)))
|
||||
__check_null_invalid_struct ((s), sizeof (*(s)))
|
||||
#define check_null_invalid_struct_errno(s) \
|
||||
__check_null_invalid_struct_errno ((s), sizeof (*(s)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue