/[svn]/linuxsampler/trunk/src/common/Condition.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Condition.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 416 by schoenebeck, Tue May 4 18:52:24 2004 UTC revision 417 by persson, Tue Mar 1 21:55:51 2005 UTC
# Line 20  Line 20 
20   *   MA  02111-1307  USA                                                   *   *   MA  02111-1307  USA                                                   *
21   ***************************************************************************/   ***************************************************************************/
22    
23    #include <sys/time.h>
24    
25  #include "Condition.h"  #include "Condition.h"
26    
27  #include "global.h"  #include "global.h"
# Line 43  int Condition::WaitIf(bool bCondition, l Line 45  int Condition::WaitIf(bool bCondition, l
45      if (this->bCondition == bCondition) {      if (this->bCondition == bCondition) {
46          if (bCondition) { // wait until condition turned 'false'          if (bCondition) { // wait until condition turned 'false'
47              if (TimeoutSeconds || TimeoutNanoSeconds) { // wait with timeout              if (TimeoutSeconds || TimeoutNanoSeconds) { // wait with timeout
48                    struct timeval now;
49                    gettimeofday(&now, 0);
50                  timespec timeout;                  timespec timeout;
51                  timeout.tv_sec  = TimeoutSeconds;                  timeout.tv_sec  = now.tv_sec + TimeoutSeconds;
52                  timeout.tv_nsec = TimeoutNanoSeconds;                  timeout.tv_nsec = now.tv_usec * 1000 + TimeoutNanoSeconds;
53                  dmsg(7,("Condition::Waitif() -> waiting for 'false' condition with timeout\n"));                  dmsg(7,("Condition::Waitif() -> waiting for 'false' condition with timeout\n"));
54                  res = pthread_cond_timedwait(&__posix_false_condition, &__posix_mutex, &timeout);                  res = pthread_cond_timedwait(&__posix_false_condition, &__posix_mutex, &timeout);
55                  dmsg(7,("Condition::Waitif() -> awakened from 'false' condition waiting\n"));                  dmsg(7,("Condition::Waitif() -> awakened from 'false' condition waiting\n"));
# Line 58  int Condition::WaitIf(bool bCondition, l Line 62  int Condition::WaitIf(bool bCondition, l
62          }          }
63          else { // wait until condition turned 'true'          else { // wait until condition turned 'true'
64              if (TimeoutSeconds || TimeoutNanoSeconds) { // wait with timeout              if (TimeoutSeconds || TimeoutNanoSeconds) { // wait with timeout
65                    struct timeval now;
66                    gettimeofday(&now, 0);
67                  timespec timeout;                  timespec timeout;
68                  timeout.tv_sec  = TimeoutSeconds;                  timeout.tv_sec  = now.tv_sec + TimeoutSeconds;
69                  timeout.tv_nsec = TimeoutNanoSeconds;                  timeout.tv_nsec = now.tv_usec * 1000 + TimeoutNanoSeconds;
70                  dmsg(7,("Condition::Waitif() -> waiting for 'true' condition with timeout\n"));                  dmsg(7,("Condition::Waitif() -> waiting for 'true' condition with timeout\n"));
71                  res = pthread_cond_timedwait(&__posix_true_condition, &__posix_mutex, &timeout);                  res = pthread_cond_timedwait(&__posix_true_condition, &__posix_mutex, &timeout);
72                  dmsg(7,("Condition::Waitif() -> awakened from 'true' condition waiting\n"));                  dmsg(7,("Condition::Waitif() -> awakened from 'true' condition waiting\n"));

Legend:
Removed from v.416  
changed lines
  Added in v.417

  ViewVC Help
Powered by ViewVC