src/thread/win32/SDL_syssem.c
branchSDL-1.2
changeset 5886 05fabaf401c9
parent 4159 a1b03ba2fcd0
child 6137 4720145f848b
equal deleted inserted replaced
5885:bc6043298ccb 5886:05fabaf401c9
    36 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
    36 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
    37 	SYNCHHANDLE id;
    37 	SYNCHHANDLE id;
    38 #else
    38 #else
    39 	HANDLE id;
    39 	HANDLE id;
    40 #endif
    40 #endif
    41 	Uint32 volatile count;
    41 	volatile LONG count;
    42 };
    42 };
    43 
    43 
    44 
    44 
    45 /* Create a semaphore */
    45 /* Create a semaphore */
    46 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
    46 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
    54 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
    54 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
    55 		sem->id = CreateSemaphoreCE(NULL, initial_value, 32*1024, NULL);
    55 		sem->id = CreateSemaphoreCE(NULL, initial_value, 32*1024, NULL);
    56 #else
    56 #else
    57 		sem->id = CreateSemaphore(NULL, initial_value, 32*1024, NULL);
    57 		sem->id = CreateSemaphore(NULL, initial_value, 32*1024, NULL);
    58 #endif
    58 #endif
    59 		sem->count = initial_value;
    59 		sem->count = (LONG) initial_value;
    60 		if ( ! sem->id ) {
    60 		if ( ! sem->id ) {
    61 			SDL_SetError("Couldn't create semaphore");
    61 			SDL_SetError("Couldn't create semaphore");
    62 			SDL_free(sem);
    62 			SDL_free(sem);
    63 			sem = NULL;
    63 			sem = NULL;
    64 		}
    64 		}
   134 {
   134 {
   135 	if ( ! sem ) {
   135 	if ( ! sem ) {
   136 		SDL_SetError("Passed a NULL sem");
   136 		SDL_SetError("Passed a NULL sem");
   137 		return 0;
   137 		return 0;
   138 	}
   138 	}
   139 	return sem->count;
   139 	return (Uint32) sem->count;
   140 }
   140 }
   141 
   141 
   142 int SDL_SemPost(SDL_sem *sem)
   142 int SDL_SemPost(SDL_sem *sem)
   143 {
   143 {
   144 	if ( ! sem ) {
   144 	if ( ! sem ) {