diff src/thread/irix/SDL_syssem.c @ 1499:ad887c988713

Fixed bug #150 memory leak in SDL_thread.c
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Mar 2006 01:18:29 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
line wrap: on
line diff
--- a/src/thread/irix/SDL_syssem.c	Sun Mar 12 00:57:50 2006 +0000
+++ b/src/thread/irix/SDL_syssem.c	Sun Mar 12 01:18:29 2006 +0000
@@ -67,30 +67,13 @@
 	extern int _creating_thread_lock;	/* SDL_threads.c */
 	SDL_sem *sem;
 	union semun init;
-	key_t key;
 
 	sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
 	if ( sem == NULL ) {
 		SDL_OutOfMemory();
 		return(NULL);
 	}
-	/* This flag is true if we are creating the thread manager sem,
-	   which is never freed.  This allows us to reuse the same sem.
-	*/
-	if ( _creating_thread_lock ) {
-		key = 'S'+'D'+'L';
-	} else {
-		key = IPC_PRIVATE;
-	}
-	/* Keep trying to create sem while we don't own the requested key */
-	do {
-		if ( key != IPC_PRIVATE ) {
-			++key;
-		}
-		sem->id = semget(key, 1, (0600|IPC_CREAT));
-	} while ((sem->id < 0) && (key != IPC_PRIVATE) && (errno == EACCES));
-
-	/* Report the error if we eventually failed */
+	sem->id = semget(IPC_PRIVATE, 1, (0600|IPC_CREAT));
 	if ( sem->id < 0 ) {
 		SDL_SetError("Couldn't create semaphore");
 		SDL_free(sem);