Changeset d923fca for tests/concurrency/lockfree_stack.cfa
- Timestamp:
- Feb 18, 2025, 12:54:23 PM (6 weeks ago)
- Branches:
- master
- Children:
- 8705a11
- Parents:
- 3e5fea2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tests/concurrency/lockfree_stack.cfa ¶
r3e5fea2 rd923fca 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // lockfree_stack.cfa -- 7 // lockfree_stack.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr … … 12 12 // Last Modified On : Fri Jun 9 14:01:07 2023 13 13 // Update Count : 68 14 // 14 // 15 15 16 16 #include <thread.hfa> … … 42 42 n.next = stack; // atomic assignment unnecessary 43 43 for () { // busy wait 44 Link temp{ &n, n.next.count + 1};44 Link temp{ { &n, n.next.count + 1 } }; 45 45 if ( CASV( s.stack.atom, n.next.atom, temp.atom ) ) break; // attempt to update top node 46 46 } … … 51 51 for () { // busy wait 52 52 if ( t.top == NULL ) return NULL; // empty stack ? 53 Link temp{ t.top->next.top, t.count};53 Link temp{ { t.top->next.top, t.count } }; 54 54 if ( CASV( stack.atom, t.atom, temp.atom ) ) return t.top; // attempt to update top node 55 55 } … … 62 62 63 63 thread Worker {}; 64 void main( Worker & w) {64 void main( Worker & ) { 65 65 for ( i; Times ) { 66 66 Node & n = *pop( stack ); // pop any node
Note: See TracChangeset
for help on using the changeset viewer.