Changeset 731


Ignore:
Timestamp:
Nov 22, 2015, 2:54:35 PM (9 years ago)
Author:
alain
Message:

Introduce a giet_pthhread_yield() to deschedule the blocking functions
when a channel is empty (read) or full (write).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/mwmr_channel.c

    r722 r731  
    321321        }
    322322
    323         // we could deschedule before retry...
    324         // giet_context_switch();
     323        // deschedule before retry
     324        giet_pthread_yield();
    325325    }
    326326} // end mwmr_write()
     
    408408        }
    409409
    410         // we could deschedule before retry...
    411         // giet_context_switch();
     410        // deschedule before retry
     411        giet_pthread_yield();
    412412    }
    413413} // end mwmr_read()
     
    472472        {
    473473            items = nb_mwmr_read( bufio->mwmr , (uint32_t*)bufio->base , bufio->nitems );
     474
     475            // deschedule if channel empty
     476            if (items == 0 ) giet_pthread_yield();
    474477        }
    475478        while ( items == 0 );
     
    513516            {
    514517                items = nb_mwmr_read( bufio->mwmr , (uint32_t*)bufio->base , bufio->nitems );
     518
     519                // deschedule if channel empty
     520                if (items == 0 ) giet_pthread_yield();
    515521            }
    516522            while ( items == 0 );
Note: See TracChangeset for help on using the changeset viewer.