Changeset 83a071f9 for src/tests/thread.c
- Timestamp:
- Aug 11, 2017, 10:10:26 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- fd344aa
- Parents:
- 8499c707
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/thread.c
r8499c707 r83a071f9 7 7 thread Second { semaphore* lock; }; 8 8 9 void ?{}( First & this, semaphore * lock ) { this.lock =lock; }10 void ?{}( Second & this, semaphore * lock ) { this.lock =lock; }9 void ?{}( First & this, semaphore & lock ) { this.lock = &lock; } 10 void ?{}( Second & this, semaphore & lock ) { this.lock = &lock; } 11 11 12 void main(First *this) {12 void main(First& this) { 13 13 for(int i = 0; i < 10; i++) { 14 14 sout | "First : Suspend No." | i + 1 | endl; 15 15 yield(); 16 16 } 17 V(this ->lock);17 V(this.lock); 18 18 } 19 19 20 void main(Second *this) {21 P(this ->lock);20 void main(Second& this) { 21 P(this.lock); 22 22 for(int i = 0; i < 10; i++) { 23 23 sout | "Second : Suspend No." | i + 1 | endl; … … 33 33 processor p; 34 34 { 35 First f = { &lock };36 Second s = { &lock };35 First f = { lock }; 36 Second s = { lock }; 37 37 } 38 38 }
Note: See TracChangeset
for help on using the changeset viewer.