Changeset 629c95a
- Timestamp:
- May 15, 2023, 1:15:12 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- c0ec8b6
- Parents:
- 5a05946
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/channel.hfa
r5a05946 r629c95a 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2021 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // channel.hfa -- LIBCFATHREAD 8 // Runtime locks that used with the runtime thread system. 9 // 10 // Author : Colby Alexander Parsons 11 // Created On : Thu Jan 21 19:46:50 2022 12 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 15 // 16 1 17 #pragma once 2 18 3 19 #include <locks.hfa> 4 20 #include <list.hfa> 5 #include <mutex_stmt.hfa>6 21 #include "select.hfa" 7 22 … … 44 59 T * buffer; 45 60 dlist( select_node ) prods, cons; // lists of blocked threads 46 go_mutex mutex_lock; // MX lock47 bool closed; // indicates channel close/open61 go_mutex mutex_lock; // MX lock 62 bool closed; // indicates channel close/open 48 63 #ifdef CHAN_STATS 49 64 size_t blocks, operations; // counts total ops and ops resulting in a blocked thd … … 308 323 /////////////////////////////////////////////////////////////////////////////////////////// 309 324 static inline bool unregister_chan( channel(T) & chan, select_node & node ) with(chan) { 310 // if ( !node`isListed && !node.park_counter ) return false; // handle special OR case 325 // if ( !node`isListed && !node.park_counter ) return false; // handle special OR case C_TODO: try adding this back 311 326 lock( mutex_lock ); 312 327 if ( node`isListed ) { // op wasn't performed … … 360 375 if ( __handle_waituntil_OR( prods ) ) { 361 376 __prods_handoff( chan, ret ); 377 __make_select_node_sat( node ); // need to to mark SAT now that we know operation is done or else threads could get stuck in __mark_select_node 362 378 unlock( mutex_lock ); 363 379 return true; … … 449 465 if ( __handle_waituntil_OR( cons ) ) { 450 466 __cons_handoff( chan, elem ); 467 __make_select_node_sat( node ); // need to to mark SAT now that we know operation is done or else threads could get stuck in __mark_select_node 451 468 unlock( mutex_lock ); 452 469 return true; … … 504 521 } 505 522 506 507 523 } // forall( T ) 508 524 509 525 510
Note: See TracChangeset
for help on using the changeset viewer.