/[svn]/linuxsampler/trunk/src/testcases/ConditionTest.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/testcases/ConditionTest.cpp

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

revision 211 by schoenebeck, Sun Jul 25 23:27:41 2004 UTC revision 3552 by schoenebeck, Tue Aug 6 13:18:59 2019 UTC
# Line 9  using namespace std; Line 9  using namespace std;
9    
10  // ConditionChecker  // ConditionChecker
11    
12  ConditionTest::ConditionChecker::ConditionChecker(bool waitFor) : Thread(false, 0, -4) {  ConditionTest::ConditionChecker::ConditionChecker(bool waitFor) : Thread(false, false, 0, -4) {
13      resource = 0;      resource = 0;
14      this->waitFor = waitFor;      this->waitFor = waitFor;
15  }  }
# Line 17  ConditionTest::ConditionChecker::Conditi Line 17  ConditionTest::ConditionChecker::Conditi
17  int ConditionTest::ConditionChecker::Main() {  int ConditionTest::ConditionChecker::Main() {
18      condition.WaitAndUnlockIf(!waitFor);      condition.WaitAndUnlockIf(!waitFor);
19      resource++;      resource++;
20        return 0;
21  }  }
22    
23    
24  // ConditionSetter  // ConditionSetter
25    
26  ConditionTest::ConditionSetter::ConditionSetter(Condition* condition, bool toSet) : Thread(false, 0, -4) {  ConditionTest::ConditionSetter::ConditionSetter(Condition* condition, bool toSet) : Thread(false, false, 0, -4) {
27      resource = 0;      resource = 0;
28      this->toSet = toSet;      this->toSet = toSet;
29      this->condition = condition;      this->condition = condition;
# Line 31  ConditionTest::ConditionSetter::Conditio Line 32  ConditionTest::ConditionSetter::Conditio
32  int ConditionTest::ConditionSetter::Main() {  int ConditionTest::ConditionSetter::Main() {
33      condition->Set(toSet);      condition->Set(toSet);
34      resource++;      resource++;
35        return 0;
36  }  }
37    
38    
# Line 45  ConditionTest::ConditionCheckerLocking:: Line 47  ConditionTest::ConditionCheckerLocking::
47  int ConditionTest::ConditionCheckerLocking::Main() {  int ConditionTest::ConditionCheckerLocking::Main() {
48      staticcondition.WaitIf(!waitFor);      staticcondition.WaitIf(!waitFor);
49      resource++;      resource++;
50      while (!doUnlock) usleep(1000); // sleep until ordered to unlock the condition again      while (!doUnlock) {
51                    usleep(1000); // sleep until ordered to unlock the condition again
52    #if CONFIG_PTHREAD_TESTCANCEL
53                    TestCancel();
54    #endif
55            }
56      staticcondition.Unlock();      staticcondition.Unlock();
57        return 0;
58  }  }
59    
60    

Legend:
Removed from v.211  
changed lines
  Added in v.3552

  ViewVC Help
Powered by ViewVC