changeset 1630:eba962f9d603

Fixed compile error
author Sam Lantinga <slouken@libsdl.org>
date Thu, 13 Apr 2006 14:27:58 +0000
parents ef4a796e7f24
children 510b009a864c
files src/thread/pthread/SDL_syssem.c
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/thread/pthread/SDL_syssem.c	Thu Apr 13 14:17:48 2006 +0000
+++ b/src/thread/pthread/SDL_syssem.c	Thu Apr 13 14:27:58 2006 +0000
@@ -35,7 +35,7 @@
 #else
 
 struct SDL_semaphore {
-	sem_t *sem;
+	sem_t sem;
 };
 
 /* Create a semaphore, initialized with value */
@@ -43,12 +43,10 @@
 {
 	SDL_sem *sem = (SDL_sem *) SDL_malloc(sizeof(SDL_sem));
 	if ( sem ) {
-		if ( sem_init(&sem->sem_data, 0, initial_value) < 0 ) {
+		if ( sem_init(&sem->sem, 0, initial_value) < 0 ) {
 			SDL_SetError("sem_init() failed");
 			SDL_free(sem);
 			sem = NULL;
-		} else {
-			sem->sem = &sem->sem_data;
 		}
 	} else {
 		SDL_OutOfMemory();
@@ -59,7 +57,7 @@
 void SDL_DestroySemaphore(SDL_sem *sem)
 {
 	if ( sem ) {
-		sem_destroy(sem->sem);
+		sem_destroy(&sem->sem);
 		SDL_free(sem);
 	}
 }
@@ -73,7 +71,7 @@
 		return -1;
 	}
 	retval = SDL_MUTEX_TIMEDOUT;
-	if ( sem_trywait(sem->sem) == 0 ) {
+	if ( sem_trywait(&sem->sem) == 0 ) {
 		retval = 0;
 	}
 	return retval;
@@ -88,7 +86,7 @@
 		return -1;
 	}
 
-	retval = sem_wait(sem->sem);
+	retval = sem_wait(&sem->sem);
 	if ( retval < 0 ) {
 		SDL_SetError("sem_wait() failed");
 	}
@@ -130,7 +128,7 @@
 {
 	int ret = 0;
 	if ( sem ) {
-		sem_getvalue(sem->sem, &ret);
+		sem_getvalue(&sem->sem, &ret);
 		if ( ret < 0 ) {
 			ret = 0;
 		}
@@ -147,7 +145,7 @@
 		return -1;
 	}
 
-	retval = sem_post(sem->sem);
+	retval = sem_post(&sem->sem);
 	if ( retval < 0 ) {
 		SDL_SetError("sem_post() failed");
 	}