include/SDL_mutex.h
changeset 7191 75360622e65f
parent 6977 b73d51026c68
child 7654 e8cbbb272243
     1.1 --- a/include/SDL_mutex.h	Sat May 18 12:48:50 2013 -0700
     1.2 +++ b/include/SDL_mutex.h	Sat May 18 14:17:52 2013 -0700
     1.3 @@ -24,7 +24,7 @@
     1.4  
     1.5  /**
     1.6   *  \file SDL_mutex.h
     1.7 - *  
     1.8 + *
     1.9   *  Functions to provide thread synchronization primitives.
    1.10   */
    1.11  
    1.12 @@ -34,21 +34,19 @@
    1.13  #include "begin_code.h"
    1.14  /* Set up for C function definitions, even when using C++ */
    1.15  #ifdef __cplusplus
    1.16 -/* *INDENT-OFF* */
    1.17  extern "C" {
    1.18 -/* *INDENT-ON* */
    1.19  #endif
    1.20  
    1.21  /**
    1.22   *  Synchronization functions which can time out return this value
    1.23   *  if they time out.
    1.24   */
    1.25 -#define SDL_MUTEX_TIMEDOUT	1
    1.26 +#define SDL_MUTEX_TIMEDOUT  1
    1.27  
    1.28  /**
    1.29   *  This is the timeout value which corresponds to never time out.
    1.30   */
    1.31 -#define SDL_MUTEX_MAXWAIT	(~(Uint32)0)
    1.32 +#define SDL_MUTEX_MAXWAIT   (~(Uint32)0)
    1.33  
    1.34  
    1.35  /**
    1.36 @@ -67,31 +65,31 @@
    1.37  
    1.38  /**
    1.39   *  Lock the mutex.
    1.40 - *  
    1.41 + *
    1.42   *  \return 0, or -1 on error.
    1.43   */
    1.44 -#define SDL_mutexP(m)	SDL_LockMutex(m)
    1.45 +#define SDL_mutexP(m)   SDL_LockMutex(m)
    1.46  extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
    1.47  
    1.48  /**
    1.49   *  Try to lock the mutex
    1.50 - *  
    1.51 + *
    1.52   *  \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
    1.53   */
    1.54  extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
    1.55  
    1.56  /**
    1.57   *  Unlock the mutex.
    1.58 - *  
    1.59 + *
    1.60   *  \return 0, or -1 on error.
    1.61 - *  
    1.62 + *
    1.63   *  \warning It is an error to unlock a mutex that has not been locked by
    1.64   *           the current thread, and doing so results in undefined behavior.
    1.65   */
    1.66 -#define SDL_mutexV(m)	SDL_UnlockMutex(m)
    1.67 +#define SDL_mutexV(m)   SDL_UnlockMutex(m)
    1.68  extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
    1.69  
    1.70 -/** 
    1.71 +/**
    1.72   *  Destroy a mutex.
    1.73   */
    1.74  extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
    1.75 @@ -119,34 +117,34 @@
    1.76  extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
    1.77  
    1.78  /**
    1.79 - *  This function suspends the calling thread until the semaphore pointed 
    1.80 - *  to by \c sem has a positive count. It then atomically decreases the 
    1.81 + *  This function suspends the calling thread until the semaphore pointed
    1.82 + *  to by \c sem has a positive count. It then atomically decreases the
    1.83   *  semaphore count.
    1.84   */
    1.85  extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
    1.86  
    1.87  /**
    1.88   *  Non-blocking variant of SDL_SemWait().
    1.89 - *  
    1.90 - *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would 
    1.91 + *
    1.92 + *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
    1.93   *          block, and -1 on error.
    1.94   */
    1.95  extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
    1.96  
    1.97  /**
    1.98   *  Variant of SDL_SemWait() with a timeout in milliseconds.
    1.99 - *  
   1.100 - *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not 
   1.101 + *
   1.102 + *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
   1.103   *          succeed in the allotted time, and -1 on error.
   1.104 - *  
   1.105 - *  \warning On some platforms this function is implemented by looping with a 
   1.106 + *
   1.107 + *  \warning On some platforms this function is implemented by looping with a
   1.108   *           delay of 1 ms, and so should be avoided if possible.
   1.109   */
   1.110  extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
   1.111  
   1.112  /**
   1.113   *  Atomically increases the semaphore's count (not blocking).
   1.114 - *  
   1.115 + *
   1.116   *  \return 0, or -1 on error.
   1.117   */
   1.118  extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
   1.119 @@ -205,7 +203,7 @@
   1.120  
   1.121  /**
   1.122   *  Restart one of the threads that are waiting on the condition variable.
   1.123 - *  
   1.124 + *
   1.125   *  \return 0 or -1 on error.
   1.126   */
   1.127  extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
   1.128 @@ -219,11 +217,11 @@
   1.129  
   1.130  /**
   1.131   *  Wait on the condition variable, unlocking the provided mutex.
   1.132 - *  
   1.133 + *
   1.134   *  \warning The mutex must be locked before entering this function!
   1.135 - *  
   1.136 + *
   1.137   *  The mutex is re-locked once the condition variable is signaled.
   1.138 - *  
   1.139 + *
   1.140   *  \return 0 when it is signaled, or -1 on error.
   1.141   */
   1.142  extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
   1.143 @@ -233,7 +231,7 @@
   1.144   *  variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
   1.145   *  signaled in the allotted time, and -1 on error.
   1.146   *
   1.147 - *  \warning On some platforms this function is implemented by looping with a 
   1.148 + *  \warning On some platforms this function is implemented by looping with a
   1.149   *           delay of 1 ms, and so should be avoided if possible.
   1.150   */
   1.151  extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
   1.152 @@ -244,9 +242,7 @@
   1.153  
   1.154  /* Ends C function definitions when using C++ */
   1.155  #ifdef __cplusplus
   1.156 -/* *INDENT-OFF* */
   1.157  }
   1.158 -/* *INDENT-ON* */
   1.159  #endif
   1.160  #include "close_code.h"
   1.161