Loading...
threads/mig_support.c Libc-262.3.2 Libc-583
--- Libc/Libc-262.3.2/threads/mig_support.c
+++ Libc/Libc-583/threads/mig_support.c
@@ -2,8 +2,6 @@
  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
  * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
@@ -83,11 +81,11 @@
         pthread_t pself;
 #ifdef	CTHREADS_DEBUG
 	int d = cthread_debug;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
 
 #ifdef	CTHREADS_DEBUG
 	cthread_debug = FALSE;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
         pself = pthread_self();
         if ((pself != (pthread_t)NULL) && (pself->sig == _PTHREAD_SIG)) {
             if (pself->reply_port == MACH_PORT_NULL) {
@@ -99,7 +97,7 @@
 	if (self == NO_CPROC) {
 #ifdef	CTHREADS_DEBUG
 		cthread_debug = d;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
 		return(_task_reply_port);
 	}
         if (self->reply_port == MACH_PORT_NULL) {
@@ -107,7 +105,7 @@
         }
 #ifdef	CTHREADS_DEBUG
 	cthread_debug = d;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
 	return self->reply_port;
 }
 
@@ -124,18 +122,18 @@
 	register mach_port_t port;
 #ifdef	CTHREADS_DEBUG
 	int d = cthread_debug;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
 
 #ifdef	CTHREADS_DEBUG
 	cthread_debug = FALSE;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
         pself = pthread_self();
         if ((pself != (pthread_t)NULL) && (pself->sig == _PTHREAD_SIG)) {
             port = pself->reply_port;
             if (port != MACH_PORT_NULL && port != _task_reply_port) {
                     LOCK(reply_port_lock);
                     pself->reply_port = _task_reply_port;
-                    (void) mach_port_destroy(mach_task_self(), port);
+                    (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
                     pself->reply_port = MACH_PORT_NULL;
                     UNLOCK(reply_port_lock);
             }
@@ -145,7 +143,7 @@
 	if (self == NO_CPROC) {
 #ifdef	CTHREADS_DEBUG
 		cthread_debug = d;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
 		return;
 	}
 	ASSERT(self != NO_CPROC);
@@ -153,13 +151,13 @@
         if (port != MACH_PORT_NULL && port != _task_reply_port) {
 		LOCK(reply_port_lock);
                 self->reply_port = _task_reply_port;
-                (void) mach_port_destroy(mach_task_self(), port);
+		(void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
                 self->reply_port = MACH_PORT_NULL;
 		UNLOCK(reply_port_lock);
 	}
 #ifdef	CTHREADS_DEBUG
 	cthread_debug = d;
-#endif	CTHREADS_DEBUG
+#endif	/* CTHREADS_DEBUG */
 }
 
 /*************************************************************