src/thread/pthread/SDL_syscond.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/thread/pthread/SDL_syscond.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/thread/pthread/SDL_syscond.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -36,15 +36,15 @@
     1.4  
     1.5  /* Create a condition variable */
     1.6  SDL_cond *
     1.7 -SDL_CreateCond (void)
     1.8 +SDL_CreateCond(void)
     1.9  {
    1.10      SDL_cond *cond;
    1.11  
    1.12 -    cond = (SDL_cond *) SDL_malloc (sizeof (SDL_cond));
    1.13 +    cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond));
    1.14      if (cond) {
    1.15 -        if (pthread_cond_init (&cond->cond, NULL) < 0) {
    1.16 -            SDL_SetError ("pthread_cond_init() failed");
    1.17 -            SDL_free (cond);
    1.18 +        if (pthread_cond_init(&cond->cond, NULL) < 0) {
    1.19 +            SDL_SetError("pthread_cond_init() failed");
    1.20 +            SDL_free(cond);
    1.21              cond = NULL;
    1.22          }
    1.23      }
    1.24 @@ -53,28 +53,28 @@
    1.25  
    1.26  /* Destroy a condition variable */
    1.27  void
    1.28 -SDL_DestroyCond (SDL_cond * cond)
    1.29 +SDL_DestroyCond(SDL_cond * cond)
    1.30  {
    1.31      if (cond) {
    1.32 -        pthread_cond_destroy (&cond->cond);
    1.33 -        SDL_free (cond);
    1.34 +        pthread_cond_destroy(&cond->cond);
    1.35 +        SDL_free(cond);
    1.36      }
    1.37  }
    1.38  
    1.39  /* Restart one of the threads that are waiting on the condition variable */
    1.40  int
    1.41 -SDL_CondSignal (SDL_cond * cond)
    1.42 +SDL_CondSignal(SDL_cond * cond)
    1.43  {
    1.44      int retval;
    1.45  
    1.46      if (!cond) {
    1.47 -        SDL_SetError ("Passed a NULL condition variable");
    1.48 +        SDL_SetError("Passed a NULL condition variable");
    1.49          return -1;
    1.50      }
    1.51  
    1.52      retval = 0;
    1.53 -    if (pthread_cond_signal (&cond->cond) != 0) {
    1.54 -        SDL_SetError ("pthread_cond_signal() failed");
    1.55 +    if (pthread_cond_signal(&cond->cond) != 0) {
    1.56 +        SDL_SetError("pthread_cond_signal() failed");
    1.57          retval = -1;
    1.58      }
    1.59      return retval;
    1.60 @@ -82,36 +82,36 @@
    1.61  
    1.62  /* Restart all threads that are waiting on the condition variable */
    1.63  int
    1.64 -SDL_CondBroadcast (SDL_cond * cond)
    1.65 +SDL_CondBroadcast(SDL_cond * cond)
    1.66  {
    1.67      int retval;
    1.68  
    1.69      if (!cond) {
    1.70 -        SDL_SetError ("Passed a NULL condition variable");
    1.71 +        SDL_SetError("Passed a NULL condition variable");
    1.72          return -1;
    1.73      }
    1.74  
    1.75      retval = 0;
    1.76 -    if (pthread_cond_broadcast (&cond->cond) != 0) {
    1.77 -        SDL_SetError ("pthread_cond_broadcast() failed");
    1.78 +    if (pthread_cond_broadcast(&cond->cond) != 0) {
    1.79 +        SDL_SetError("pthread_cond_broadcast() failed");
    1.80          retval = -1;
    1.81      }
    1.82      return retval;
    1.83  }
    1.84  
    1.85  int
    1.86 -SDL_CondWaitTimeout (SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
    1.87 +SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
    1.88  {
    1.89      int retval;
    1.90      struct timeval delta;
    1.91      struct timespec abstime;
    1.92  
    1.93      if (!cond) {
    1.94 -        SDL_SetError ("Passed a NULL condition variable");
    1.95 +        SDL_SetError("Passed a NULL condition variable");
    1.96          return -1;
    1.97      }
    1.98  
    1.99 -    gettimeofday (&delta, NULL);
   1.100 +    gettimeofday(&delta, NULL);
   1.101  
   1.102      abstime.tv_sec = delta.tv_sec + (ms / 1000);
   1.103      abstime.tv_nsec = (delta.tv_usec + (ms % 1000) * 1000) * 1000;
   1.104 @@ -121,7 +121,7 @@
   1.105      }
   1.106  
   1.107    tryagain:
   1.108 -    retval = pthread_cond_timedwait (&cond->cond, &mutex->id, &abstime);
   1.109 +    retval = pthread_cond_timedwait(&cond->cond, &mutex->id, &abstime);
   1.110      switch (retval) {
   1.111      case EINTR:
   1.112          goto tryagain;
   1.113 @@ -132,7 +132,7 @@
   1.114      case 0:
   1.115          break;
   1.116      default:
   1.117 -        SDL_SetError ("pthread_cond_timedwait() failed");
   1.118 +        SDL_SetError("pthread_cond_timedwait() failed");
   1.119          retval = -1;
   1.120          break;
   1.121      }
   1.122 @@ -143,18 +143,18 @@
   1.123     The mutex must be locked before entering this function!
   1.124   */
   1.125  int
   1.126 -SDL_CondWait (SDL_cond * cond, SDL_mutex * mutex)
   1.127 +SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
   1.128  {
   1.129      int retval;
   1.130  
   1.131      if (!cond) {
   1.132 -        SDL_SetError ("Passed a NULL condition variable");
   1.133 +        SDL_SetError("Passed a NULL condition variable");
   1.134          return -1;
   1.135      }
   1.136  
   1.137      retval = 0;
   1.138 -    if (pthread_cond_wait (&cond->cond, &mutex->id) != 0) {
   1.139 -        SDL_SetError ("pthread_cond_wait() failed");
   1.140 +    if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
   1.141 +        SDL_SetError("pthread_cond_wait() failed");
   1.142          retval = -1;
   1.143      }
   1.144      return retval;