Changes to compile on CentOS-5.3

main
rfm 17 years ago
parent bba507bf70
commit 102084ab7c

@ -136,6 +136,7 @@ typedef struct class_node
#include "lock.h" #include "lock.h"
static class_node_ptr class_table_array[CLASS_TABLE_SIZE]; static class_node_ptr class_table_array[CLASS_TABLE_SIZE];
static int __class_table_was_set_up = 0;
/* The table writing mutex - we lock on writing to avoid conflicts /* The table writing mutex - we lock on writing to avoid conflicts
between different writers, but we read without locks. That is between different writers, but we read without locks. That is
@ -163,17 +164,6 @@ static mutex_t __class_table_lock;
\ \
HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK; HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK;
/* Setup the table. */
static void
class_table_setup (void)
{
/* Start - nothing in the table. */
memset (class_table_array, 0, sizeof (class_node_ptr) * CLASS_TABLE_SIZE);
/* The table writing mutex. */
INIT_LOCK(__class_table_lock);
}
/* Insert a class in the table (used when a new class is registered). */ /* Insert a class in the table (used when a new class is registered). */
static void static void
@ -428,13 +418,19 @@ __objc_init_class_tables (void)
{ {
/* Allocate the class hash table. */ /* Allocate the class hash table. */
if (__class_table_lock) if (__class_table_was_set_up)
return; return;
LOCK(__objc_runtime_mutex); LOCK(__objc_runtime_mutex);
if (!__class_table_was_set_up)
{
/* Start - nothing in the table. */
memset (class_table_array, 0, sizeof (class_node_ptr) * CLASS_TABLE_SIZE);
class_table_setup (); /* The table writing mutex. */
INIT_LOCK(__class_table_lock);
__class_table_was_set_up = 1;
}
UNLOCK(__objc_runtime_mutex); UNLOCK(__objc_runtime_mutex);
} }

@ -14,6 +14,7 @@ typedef HANDLE mutex_t;
#else #else
#define _XOPEN 500 #define _XOPEN 500
#define __USE_UNIX98 1
# include <pthread.h> # include <pthread.h>
typedef pthread_mutex_t mutex_t; typedef pthread_mutex_t mutex_t;

Loading…
Cancel
Save