src/thread/windows/SDL_sysmutex.c
changeset 6966 090df160f6e0
parent 6885 700f1b25f77f
child 6969 74cf567e8618
equal deleted inserted replaced
6965:ab4bb4e99961 6966:090df160f6e0
    73 
    73 
    74     EnterCriticalSection(&mutex->cs);
    74     EnterCriticalSection(&mutex->cs);
    75     return (0);
    75     return (0);
    76 }
    76 }
    77 
    77 
       
    78 /* TryLock the mutex */
       
    79 int
       
    80 SDL_TryLockMutex(SDL_mutex * mutex)
       
    81 {
       
    82     if (mutex == NULL) {
       
    83         SDL_SetError("Passed a NULL mutex");
       
    84         return -1;
       
    85     }
       
    86 
       
    87     int retval = 0;
       
    88     if (TryEnterCriticalSection(&mutex->cs) == 0) {
       
    89         retval = SDL_MUTEX_TIMEDOUT;
       
    90     }
       
    91     return retval;
       
    92 }
       
    93 
    78 /* Unlock the mutex */
    94 /* Unlock the mutex */
    79 int
    95 int
    80 SDL_mutexV(SDL_mutex * mutex)
    96 SDL_mutexV(SDL_mutex * mutex)
    81 {
    97 {
    82     if (mutex == NULL) {
    98     if (mutex == NULL) {