src/thread/stdcpp/SDL_sysmutex.cpp
changeset 8611 a762dfc67e1a
parent 8600 092802455aed
child 8615 097646deaef2
     1.1 --- a/src/thread/stdcpp/SDL_sysmutex.cpp	Tue Mar 11 12:40:31 2014 -0400
     1.2 +++ b/src/thread/stdcpp/SDL_sysmutex.cpp	Wed Mar 12 11:57:15 2014 -0400
     1.3 @@ -79,6 +79,21 @@
     1.4      }
     1.5  }
     1.6  
     1.7 +/* TryLock the mutex */
     1.8 +int
     1.9 +SDL_TryLockMutex(SDL_mutex * mutex)
    1.10 +{
    1.11 +    int retval = 0;
    1.12 +    if (mutex == NULL) {
    1.13 +        return SDL_SetError("Passed a NULL mutex");
    1.14 +    }
    1.15 +
    1.16 +    if (mutex->cpp_mutex.try_lock() == false) {
    1.17 +        retval = SDL_MUTEX_TIMEDOUT;
    1.18 +    }
    1.19 +    return retval;
    1.20 +}
    1.21 +
    1.22  /* Unlock the mutex */
    1.23  extern "C"
    1.24  int