* pthread.cc (pthread_mutex_init): Explicitly fill out third arg to

pthread_mutex::init.
* thread.cc: Remov some obsolete comments.
(verifyable_object_isvalid): Reflect change to use thread_magic_t for magic
numbers.
(pthread_mutex::pthread_mutex): Set magic number to invalid initially until
we've verified that everything is valid.
(pthread_mutex::unlock): Fix a comment.
(verifyable_object::verifyable_object): Delete here.
(~verifyable_object::~verifyable_object): Ditto.
(pthread_mutex::init): Don't run is_good_initializer for non-static objects.
* thread.h (thread_magic_t): New typedef.
(verifyable_object::verifyable_object): Use thread_magic_t;
(verifyable_object::magic): Ditto.
(pthread_mutex::is_good_initializer_or_bad_object): Remove unneeded variable
names.
(pthread_mutex::can_be_unlocked): Ditto.
(pthread_mutex::init): Ditto.  Remove default for third argument.
This commit is contained in:
Christopher Faylor
2010-02-12 20:07:13 +00:00
parent 97e5d3ffa4
commit 2b1407d372
4 changed files with 46 additions and 63 deletions

View File

@@ -100,15 +100,17 @@ class pinfo;
#define MUTEX_OWNER_ANONYMOUS ((pthread_t) -1)
typedef unsigned long thread_magic_t;
/* verifyable_object should not be defined here - it's a general purpose class */
class verifyable_object
{
public:
long magic;
thread_magic_t magic;
verifyable_object (long);
virtual ~verifyable_object ();
verifyable_object (thread_magic_t verifyer): magic (verifyer) {}
virtual ~verifyable_object () { magic = 0; }
};
typedef enum
@@ -268,11 +270,11 @@ public:
static bool is_good_object (pthread_mutex_t const *);
static bool is_good_initializer (pthread_mutex_t const *);
static bool is_good_initializer_or_object (pthread_mutex_t const *);
static bool is_good_initializer_or_bad_object (pthread_mutex_t const *mutex);
static bool can_be_unlocked (pthread_mutex_t const *mutex);
static bool is_good_initializer_or_bad_object (pthread_mutex_t const *);
static bool can_be_unlocked (pthread_mutex_t const *);
static void init_mutex ();
static int init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr,
const pthread_mutex_t initializer = NULL);
static int init (pthread_mutex_t *, const pthread_mutexattr_t *attr,
const pthread_mutex_t);
unsigned long lock_counter;
HANDLE win32_obj_id;