2002-10-17 Robert Collins <rbtcollins@hotmail.com>
* thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare.
        * thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement.
        (pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid
        unneeded SEGV's during debugging.
			
			
This commit is contained in:
		| @@ -1,3 +1,10 @@ | |||||||
|  | 2002-10-17  Robert Collins  <rbtcollins@hotmail.com> | ||||||
|  |  | ||||||
|  | 	* thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare. | ||||||
|  | 	* thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement. | ||||||
|  | 	(pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid | ||||||
|  | 	unneeded SEGV's during debugging. | ||||||
|  |  | ||||||
| 2002-10-17  Thomas Pfaff  <tpfaff@gmx.net> | 2002-10-17  Thomas Pfaff  <tpfaff@gmx.net> | ||||||
|   |   | ||||||
| 	* thread.cc (verifyable_object_isvalid): Test for static object first. | 	* thread.cc (verifyable_object_isvalid): Test for static object first. | ||||||
|   | |||||||
| @@ -1098,6 +1098,15 @@ pthread_mutex::isGoodInitializerOrObject (pthread_mutex_t const *mutex) | |||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | bool  | ||||||
|  | pthread_mutex::isGoodInitializerOrBadObject (pthread_mutex_t const *mutex) | ||||||
|  | { | ||||||
|  |     verifyable_object_state objectState = verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC, PTHREAD_MUTEX_INITIALIZER); | ||||||
|  |     if (objectState == VALID_OBJECT) | ||||||
|  | 	return false; | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  |  | ||||||
| /* This is used for mutex creation protection within a single process only */ | /* This is used for mutex creation protection within a single process only */ | ||||||
| pthread_mutex::nativeMutex pthread_mutex::mutexInitializationLock NO_COPY; | pthread_mutex::nativeMutex pthread_mutex::mutexInitializationLock NO_COPY; | ||||||
|  |  | ||||||
| @@ -2256,8 +2265,7 @@ pthread_mutex::init (pthread_mutex_t *mutex, | |||||||
|   if (!mutexInitializationLock.lock ()) |   if (!mutexInitializationLock.lock ()) | ||||||
|     return EINVAL; |     return EINVAL; | ||||||
|  |  | ||||||
|   /* FIXME: bugfix: we should check *mutex being a valid address */ |   if (!isGoodInitializerOrBadObject (mutex)) | ||||||
|   if (isGoodObject (mutex)) |  | ||||||
|     { |     { | ||||||
|       mutexInitializationLock.unlock (); |       mutexInitializationLock.unlock (); | ||||||
|       return EBUSY; |       return EBUSY; | ||||||
|   | |||||||
| @@ -291,6 +291,7 @@ public: | |||||||
|   static bool isGoodObject(pthread_mutex_t const *); |   static bool isGoodObject(pthread_mutex_t const *); | ||||||
|   static bool isGoodInitializer(pthread_mutex_t const *); |   static bool isGoodInitializer(pthread_mutex_t const *); | ||||||
|   static bool isGoodInitializerOrObject(pthread_mutex_t const *); |   static bool isGoodInitializerOrObject(pthread_mutex_t const *); | ||||||
|  |   static bool isGoodInitializerOrBadObject (pthread_mutex_t const *mutex); | ||||||
|   static void initMutex (); |   static void initMutex (); | ||||||
|   static int init (pthread_mutex_t *, const pthread_mutexattr_t *); |   static int init (pthread_mutex_t *, const pthread_mutexattr_t *); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user