Changeset 86601a5
- Timestamp:
- Jun 21, 2022, 11:56:57 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- b0be3713
- Parents:
- 5a96b36 (diff), 1dbbef6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/unified_locking/mutex_test.hfa
r5a96b36 r86601a5 22 22 } 23 23 24 uint32_t cs( ) {24 uint32_t cs(uint32_t & entries) { 25 25 thread$ * me = active_thread(); 26 26 uint32_t value; 27 27 lock(mo.l); 28 28 { 29 entries++; 29 30 uint32_t tsum = mo.sum; 30 31 uint32_t cnt = mo.cnt; … … 42 43 thread LockCheck { 43 44 uint32_t sum; 45 uint32_t entries; 44 46 }; 45 47 46 48 void main(LockCheck & this) { 47 49 this.sum = 0; 50 this.entries = 0; 48 51 for(num_times) { 49 52 trash(); 50 this.sum += cs( );53 this.sum += cs( this.entries ); 51 54 trash(); 52 55 yield(random(10)); … … 58 61 mo.sum = -32; 59 62 mo.cnt = 0; 63 uint32_t real_entries = 0; 60 64 processor p[2]; 61 65 sout | "Starting"; … … 63 67 LockCheck checkers[13]; 64 68 for(i;13) { 65 sum += join(checkers[i]).sum; 69 LockCheck & curr = join(checkers[i]); 70 sum += curr.sum; 71 real_entries += curr.entries; 66 72 } 67 73 } 68 74 sout | "Done!"; 69 if(mo.cnt != (13 * num_times)) sout | "Invalid cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')'; 75 if(real_entries != (13 * num_times)) sout | "Invalid real cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')'; 76 if(mo.cnt != (13 * num_times)) sout | "Invalid concurrent cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')'; 70 77 if(sum == mo.sum) sout | "Match!"; 71 78 else sout | "No Match!" | sum | "vs" | mo.sum;
Note: See TracChangeset
for help on using the changeset viewer.