- Timestamp:
- Mar 21, 2022, 11:50:25 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 080d2d7
- Parents:
- 22226e4
- Location:
- tests/concurrent/mutexstmt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/mutexstmt/.expect/locks.txt
r22226e4 r51239d1b 3 3 Start Test: multi lock deadlock/mutual exclusion 4 4 End Test: multi lock deadlock/mutual exclusion 5 Start Test: multi polymorphic lock deadlock/mutual exclusion 6 End Test: multi polymorphic lock deadlock/mutual exclusion -
tests/concurrent/mutexstmt/locks.cfa
r22226e4 r51239d1b 4 4 5 5 const unsigned int num_times = 10000; 6 7 Duration default_preemption() { return 0; } 6 8 7 9 single_acquisition_lock m1, m2, m3, m4, m5; … … 23 25 } 24 26 27 void refTest( single_acquisition_lock & m ) { 28 mutex ( m ) { 29 assert(!insideFlag); 30 insideFlag = true; 31 assert(insideFlag); 32 insideFlag = false; 33 } 34 } 35 25 36 thread T_Multi {}; 26 37 27 38 void main( T_Multi & this ) { 28 39 for (unsigned int i = 0; i < num_times; i++) { 40 refTest( m1 ); 29 41 mutex ( m1 ) { 30 42 assert(!insideFlag); … … 60 72 } 61 73 74 single_acquisition_lock l1; 75 linear_backoff_then_block_lock l2; 76 owner_lock l3; 77 78 thread T_Multi_Poly {}; 79 80 void main( T_Multi_Poly & this ) { 81 for (unsigned int i = 0; i < num_times; i++) { 82 refTest( l1 ); 83 mutex ( l1 ) { 84 assert(!insideFlag); 85 insideFlag = true; 86 assert(insideFlag); 87 insideFlag = false; 88 } 89 mutex ( l1, l2, l3 ) { 90 assert(!insideFlag); 91 insideFlag = true; 92 assert(insideFlag); 93 insideFlag = false; 94 } 95 mutex ( l3, l1 ) { 96 assert(!insideFlag); 97 insideFlag = true; 98 assert(insideFlag); 99 insideFlag = false; 100 } 101 mutex ( l1, l2 ) { 102 assert(!insideFlag); 103 insideFlag = true; 104 assert(insideFlag); 105 insideFlag = false; 106 } 107 } 108 } 109 62 110 int num_tasks = 10; 63 111 int main() { 64 processor p[ 10];112 processor p[num_tasks - 1]; 65 113 66 114 printf("Start Test: single lock mutual exclusion\n"); 67 115 { 68 T_Mutex t[ 10];116 T_Mutex t[num_tasks]; 69 117 } 70 118 assert(count == num_tasks * num_times); … … 72 120 printf("Start Test: multi lock deadlock/mutual exclusion\n"); 73 121 { 74 T_Multi t[ 10];122 T_Multi t[num_tasks]; 75 123 } 76 124 printf("End Test: multi lock deadlock/mutual exclusion\n"); 125 printf("Start Test: multi polymorphic lock deadlock/mutual exclusion\n"); 126 { 127 T_Multi_Poly t[num_tasks]; 128 } 129 printf("End Test: multi polymorphic lock deadlock/mutual exclusion\n"); 77 130 }
Note: See TracChangeset
for help on using the changeset viewer.