Changeset e6e250d
- Timestamp:
- Mar 29, 2026, 11:03:25 PM (3 days ago)
- Branches:
- master
- Parents:
- 81ab5eb
- Files:
-
- 8 edited
-
libcfa/src/collections/list.hfa (modified) (5 diffs)
-
libcfa/src/collections/list2.hfa (modified) (5 diffs)
-
libcfa/src/concurrency/channel.hfa (modified) (1 diff)
-
libcfa/src/concurrency/future.hfa (modified) (2 diffs)
-
libcfa/src/concurrency/locks.cfa (modified) (3 diffs)
-
libcfa/src/concurrency/locks.hfa (modified) (2 diffs)
-
tests/list/.expect/dlist-insert-remove.txt (modified) (1 diff)
-
tests/list/dlist-insert-remove.cfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/list.hfa
r81ab5eb re6e250d 10 10 // Created On : Wed Apr 22 18:00:00 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Mar 29 2 1:20:44202613 // Update Count : 10 112 // Last Modified On : Sun Mar 29 22:59:08 2026 13 // Update Count : 104 14 14 // 15 15 … … 188 188 189 189 static inline forall( tE &, tLinks & | embedded( tE, tLinks, dlink( tE ) ) ) { 190 bool isListed( tE & node ) {190 bool listed( tE & node ) { 191 191 NOLOOSE( 192 192 verify( &node != 0p ); … … 195 195 ) 196 196 LOOSEONLY( 197 verify(false && " isListed is undefined");197 verify(false && "listed is undefined"); 198 198 return true; 199 199 ) … … 204 204 if ( ORIGIN_TAG_QUERY(( size_t)firstPtr) ) firstPtr = 0p; 205 205 return firstPtr == 0p; 206 }207 208 bool isEmpty( dlist( tE, tLinks ) & list ) { // deprecated209 return empty( list );210 206 } 211 207 … … 339 335 } 340 336 341 bool isFirst( tE & node ) {337 bool first( tE & node ) { 342 338 return recede( node ); 343 339 } 344 340 345 bool isLast( tE & node ) {341 bool last( tE & node ) { 346 342 return advance( node ); 347 343 } -
libcfa/src/collections/list2.hfa
r81ab5eb re6e250d 19 19 // Created On : Wed Apr 22 18:00:00 2020 20 20 // Last Modified By : Peter A. Buhr 21 // Last Modified On : Sun Mar 29 2 1:47:53202622 // Update Count : 1 221 // Last Modified On : Sun Mar 29 22:59:31 2026 22 // Update Count : 15 23 23 // 24 24 … … 454 454 } 455 455 456 static inline bool isEmpty( dlist(tE, tLinks) & list ) __attribute__ ((deprecated)); 457 static inline bool isEmpty( dlist(tE, tLinks) & list ) { 458 return empty( list ); 459 } 460 461 static inline bool isListed( tE & e ) { 456 static inline bool listed( tE & e ) { 462 457 NOLOOSE( 463 458 verify (&e != 0p); … … 469 464 ) 470 465 LOOSEONLY( 471 verify(false && " isListed is undefined");466 verify(false && "listed is undefined"); 472 467 return true; 473 468 ) … … 516 511 } 517 512 518 bool isFirst( tE & node ) {513 bool first( tE & node ) { 519 514 // Probable bug copied from master 520 515 // should be `! recede(node)` … … 524 519 } 525 520 526 bool isLast( tE & node ) {521 bool last( tE & node ) { 527 522 // ditto, vice versa 528 523 return advance( node ); -
libcfa/src/concurrency/channel.hfa
r81ab5eb re6e250d 369 369 /////////////////////////////////////////////////////////////////////////////////////////// 370 370 bool unregister_chan( channel(T) & chan, select_node & node ) with(chan) { 371 if ( ! isListed( node ) && ! node.park_counter ) return false; // handle special OR case371 if ( ! listed( node ) && ! node.park_counter ) return false; // handle special OR case 372 372 lock( mutex_lock ); 373 if ( isListed( node ) ) { // op wasn't performed373 if ( listed( node ) ) { // op wasn't performed 374 374 remove( node ); 375 375 unlock( mutex_lock ); -
libcfa/src/concurrency/future.hfa
r81ab5eb re6e250d 10 10 // Created On : Wed Jan 06 17:33:18 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Mar 29 2 1:13:04202613 // Update Count : 22 312 // Last Modified On : Sun Mar 29 22:47:01 2026 13 // Update Count : 224 14 14 // 15 15 … … 79 79 80 80 bool unregister_select$( future(T) & fut, select_node & s ) with( fut ) { // for waituntil statement 81 if ( ! isListed( s ) ) return false;82 lock( lock ); 83 if ( isListed( s ) ) remove( s );81 if ( ! listed( s ) ) return false; 82 lock( lock ); 83 if ( listed( s ) ) remove( s ); 84 84 unlock( lock ); 85 85 return false; -
libcfa/src/concurrency/locks.cfa
r81ab5eb re6e250d 220 220 bool unregister_select$( blocking_lock & this, select_node & node ) with(this) { 221 221 lock( lock __cfaabi_dbg_ctx2 ); 222 if ( isListed( node ) ) {222 if ( listed( node ) ) { 223 223 remove( node ); 224 224 wait_count--; … … 265 265 // may still be called after a thread has been removed from the queue but 266 266 // before the alarm is unregistered 267 if ( isListed( *info_thd ) ) { // is thread on queue267 if ( listed( *info_thd ) ) { // is thread on queue 268 268 info_thd->signalled = false; 269 269 // remove this thread O(1) … … 304 304 // may still be called after a thread has been removed from the queue but 305 305 // before the alarm is unregistered 306 if ( isListed( *info_thd ) ) { // is thread on queue306 if ( listed( *info_thd ) ) { // is thread on queue 307 307 info_thd->signalled = false; 308 308 // remove this thread O(1) -
libcfa/src/concurrency/locks.hfa
r81ab5eb re6e250d 11 11 // Created On : Thu Jan 21 19:46:50 2021 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Nov 23 22:38:45 202514 // Update Count : 6 713 // Last Modified On : Sun Mar 29 22:46:39 2026 14 // Update Count : 68 15 15 // 16 16 … … 645 645 static inline bool unregister_select$( simple_owner_lock & this, select_node & node ) with( this ) { 646 646 lock( lock __cfaabi_dbg_ctx2 ); 647 if ( isListed( node ) ) {647 if ( listed( node ) ) { 648 648 remove( node ); 649 649 unlock( lock ); -
tests/list/.expect/dlist-insert-remove.txt
r81ab5eb re6e250d 1109 1109 try_pop cases done 1110 1110 origin_mutation cases done 1111 isListed cases done1111 listed cases done -
tests/list/dlist-insert-remove.cfa
r81ab5eb re6e250d 1436 1436 // Section 4g 1437 1437 // 1438 // Test cases of empty, isFirst, isLast,1438 // Test cases of empty, first, last, 1439 1439 // remove_first, remove_last, modifications via iter 1440 1440 // … … 1469 1469 assert( &m3next == 0p ); 1470 1470 1471 assert( ! isFirst( m1 ) );1472 assert( isLast( m1 ) );1473 assert( isFirst( m2 ) );1474 assert( isLast( m2 ) );1475 assert( isFirst( m3 ) );1476 assert( ! isLast( m3 ) );1471 assert( ! first( m1 ) ); 1472 assert( last( m1 ) ); 1473 assert( first( m2 ) ); 1474 assert( last( m2 ) ); 1475 assert( first( m3 ) ); 1476 assert( ! last( m3 ) ); 1477 1477 1478 1478 printf("accessor_cases done\n"); … … 1615 1615 } 1616 1616 1617 void test__ isListed_cases__mary() {1618 1619 mary m1 = {1.7}; assert( ! isListed( m1 ) );1620 mary m2 = {2.7}; assert( ! isListed( m2 ) );1621 mary m3 = {3.7}; assert( ! isListed( m3 ) );1617 void test__listed_cases__mary() { 1618 1619 mary m1 = {1.7}; assert( ! listed( m1 ) ); 1620 mary m2 = {2.7}; assert( ! listed( m2 ) ); 1621 mary m3 = {3.7}; assert( ! listed( m3 ) ); 1622 1622 1623 1623 dlist(mary) ml; 1624 1624 1625 insert_last(ml, m1); assert( isListed( m1 ) ); assert(! isListed( m2 ) );1626 insert_last(ml, m2); assert( isListed( m2 ) ); assert(! isListed( m3 ) );1627 insert_last(ml, m3); assert( isListed( m3 ) );1628 1629 remove( m1 ); assert( ! isListed( m1 ) ); assert( isListed( m2 ) );1630 remove( m2 ); assert( ! isListed( m2 ) ); assert( isListed( m3 ) );1631 remove( m3 ); assert( ! isListed( m3 ) );1632 1633 printf(" isListed cases done\n");1625 insert_last(ml, m1); assert( listed( m1 ) ); assert(! listed( m2 ) ); 1626 insert_last(ml, m2); assert( listed( m2 ) ); assert(! listed( m3 ) ); 1627 insert_last(ml, m3); assert( listed( m3 ) ); 1628 1629 remove( m1 ); assert( ! listed( m1 ) ); assert( listed( m2 ) ); 1630 remove( m2 ); assert( ! listed( m2 ) ); assert( listed( m3 ) ); 1631 remove( m3 ); assert( ! listed( m3 ) ); 1632 1633 printf("listed cases done\n"); 1634 1634 } 1635 1635 … … 1931 1931 test__try_pop__mary(); 1932 1932 test__origin_mutation__mary(); 1933 test__ isListed_cases__mary();1933 test__listed_cases__mary(); 1934 1934 1935 1935 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.