Loading...
pthreads/pthread_tsd.c Libc-391.4.2 Libc-391
--- Libc/Libc-391.4.2/pthreads/pthread_tsd.c
+++ Libc/Libc-391/pthreads/pthread_tsd.c
@@ -59,12 +59,6 @@
 	void (*destructor)(void *);
 } _pthread_keys[_POSIX_THREAD_KEYS_MAX];
 static pthread_lock_t tds_lock = LOCK_INITIALIZER;
-/*
- * Partition _pthread_keys in a lower part that dyld can use, and an upper
- * part for libSystem.  The libSystem part starts at __pthread_tsd_first = 4.
- * dyld will set this value to 1.
- */
-__private_extern__ int __pthread_tsd_first = 4;
 
 /*
  * Create a new key for thread specific data
@@ -77,7 +71,7 @@
 	LOCK(tds_lock);
 	res = ENOMEM;  /* No 'free' keys */
 	/* The first slot is reserved for pthread_self() */
-	for (i = __pthread_tsd_first;  i < _POSIX_THREAD_KEYS_MAX;  i++)
+	for (i = 1;  i < _POSIX_THREAD_KEYS_MAX;  i++)
 	{
 		if (_pthread_keys[i].created == FALSE)
 		{
@@ -101,7 +95,7 @@
 	int res;
 	LOCK(tds_lock);
 	/* The first slot is reserved for pthread_self() */
-	if ((key >= __pthread_tsd_first) && (key < _POSIX_THREAD_KEYS_MAX))
+	if ((key > 0) && (key < _POSIX_THREAD_KEYS_MAX))
 	{
 		if (_pthread_keys[key].created)
 		{
@@ -143,7 +137,7 @@
 	int res;
 	pthread_t self;
 	/* The first slot is reserved for pthread_self() */
-	if ((key >= __pthread_tsd_first) && (key < _POSIX_THREAD_KEYS_MAX))
+	if ((key > 0) && (key < _POSIX_THREAD_KEYS_MAX))
 	{
 		if (_pthread_keys[key].created)
 		{
@@ -172,7 +166,7 @@
 	for (j = 0;  j < PTHREAD_DESTRUCTOR_ITERATIONS;  j++)
 	{
 		/* The first slot is reserved for pthread_self() */
-		for (i = __pthread_tsd_first;  i < _POSIX_THREAD_KEYS_MAX;  i++)
+		for (i = 1;  i < _POSIX_THREAD_KEYS_MAX;  i++)
 		{
 			if (_pthread_keys[i].created && (param = self->tsd[i]))
 			{