Changeset 629c95a


Ignore:
Timestamp:
May 15, 2023, 1:15:12 PM (12 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
c0ec8b6
Parents:
5a05946
Message:

fixed bug in special OR case for channels and waituntil

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
    117#pragma once
    218
    319#include <locks.hfa>
    420#include <list.hfa>
    5 #include <mutex_stmt.hfa>
    621#include "select.hfa"
    722
     
    4459    T * buffer;
    4560    dlist( select_node ) prods, cons; // lists of blocked threads
    46     go_mutex mutex_lock;            // MX lock
    47     bool closed;                    // indicates channel close/open
     61    go_mutex mutex_lock;              // MX lock
     62    bool closed;                      // indicates channel close/open
    4863    #ifdef CHAN_STATS
    4964    size_t blocks, operations;      // counts total ops and ops resulting in a blocked thd
     
    308323///////////////////////////////////////////////////////////////////////////////////////////
    309324static 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
    311326    lock( mutex_lock );
    312327    if ( node`isListed ) { // op wasn't performed
     
    360375            if ( __handle_waituntil_OR( prods ) ) {
    361376                __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
    362378                unlock( mutex_lock );
    363379                return true;
     
    449465            if ( __handle_waituntil_OR( cons ) ) {
    450466                __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
    451468                unlock( mutex_lock );
    452469                return true;
     
    504521}
    505522
    506 
    507523} // forall( T )
    508524
    509525
    510 
Note: See TracChangeset for help on using the changeset viewer.