Changeset 930b504 for tests/concurrent/park
- Timestamp:
- Feb 26, 2020, 6:13:54 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 04e6f93, 5452673, dac55004
- Parents:
- aeb5d0d (diff), 7dc2e015 (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. - Location:
- tests/concurrent/park
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/park/.expect/force_preempt.txt
raeb5d0d r930b504 1 0 Calling unpark 02 1 Calling unpark 03 2 Calling unpark 04 3 Calling unpark 05 4 Calling unpark 06 0 Parking 07 0 Unparked 08 0 Calling unpark 19 1 Parking 010 1 Unparked 011 1 Calling unpark 112 2 Parking 013 2 Unparked 014 2 Calling unpark 115 3 Parking 016 3 Unparked 017 3 Calling unpark 118 4 Parking 019 4 Unparked 020 4 Calling unpark 121 0 Parking 122 0 Unparked 123 0 Calling unpark 224 1 Parking 125 1 Unparked 126 1 Calling unpark 227 2 Parking 128 2 Unparked 129 2 Calling unpark 230 3 Parking 131 3 Unparked 132 3 Calling unpark 233 4 Parking 134 4 Unparked 135 4 Calling unpark 236 0 Parking 237 0 Unparked 238 0 Calling unpark 339 1 Parking 240 1 Unparked 241 1 Calling unpark 342 2 Parking 243 2 Unparked 244 2 Calling unpark 345 3 Parking 246 3 Unparked 247 3 Calling unpark 348 4 Parking 249 4 Unparked 250 4 Calling unpark 351 0 Parking 352 0 Unparked 353 0 Calling unpark 454 1 Parking 355 1 Unparked 356 1 Calling unpark 457 2 Parking 358 2 Unparked 359 2 Calling unpark 460 3 Parking 361 3 Unparked 362 3 Calling unpark 463 4 Parking 364 4 Unparked 365 4 Calling unpark 466 0 Parking 467 0 Unparked 468 1 Parking 469 1 Unparked 470 2 Parking 471 2 Unparked 472 3 Parking 473 3 Unparked 474 4 Parking 475 4 Unparked 4 -
tests/concurrent/park/force_preempt.cfa
raeb5d0d r930b504 16 16 } 17 17 18 thread Waiter;19 18 thread Waiter {}; 20 21 19 22 20 volatile int count = 0; … … 25 23 // Get a unique id 26 24 int id = __atomic_fetch_add(&count, 1, __ATOMIC_SEQ_CST); 25 int id_hash = id | (id << 8) | (id << 16) | (id << 24); 26 int mask = 0xCAFEBABA; 27 27 28 28 for(int i = 0; i < 5; i++) { 29 assert(mask == 0xCAFEBABA); 30 29 31 // Unpark this thread, don't force a yield 30 sout | id | "Calling unpark" | i;31 32 unpark(this); 33 assert(mask == 0xCAFEBABA); 34 35 // Hash the mask to make sure no one else messes with them 36 mask ^= id_hash; 37 assert(mask == (id_hash ^ 0xCAFEBABA)); 32 38 33 39 // Force a preemption before the call to park … … 36 42 37 43 // Park this thread, 38 sout | id | "Parking" | i;44 assert(mask == (id_hash ^ 0xCAFEBABA)); 39 45 park(); 40 sout | id | "Unparked" | i; 46 assert(mask == (id_hash ^ 0xCAFEBABA)); 47 48 // Reset the hash and recheck it 49 mask ^= id_hash; 50 assert(mask == 0xCAFEBABA); 41 51 } 42 52 }
Note: See TracChangeset
for help on using the changeset viewer.