Changeset 820 for soft


Ignore:
Timestamp:
Apr 28, 2016, 1:20:04 PM (8 years ago)
Author:
cfuguet
Message:

Improving the pthread_join function:

  • The calling thread does a context switch if the target thread has not finished yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/sys_handler.c

    r815 r820  
    13771377
    13781378    // get target thread state
    1379     unsigned int* pnorun = &psched->context[ltid].slot[CTX_NORUN_ID];
    1380 
    1381     asm volatile ( "2000:                      \n"                         
    1382                    "move  $11,  %0             \n"   /* $11 <= pnorun        */
    1383                    "lw    $11,  0($11)         \n"   /* $11 <= norun         */
    1384                    "andi  $11,  $11,    1      \n"   /* $11 <= norun & 0x1   */
    1385                    "beqz  $11,  2000b          \n"   
    1386                    :
    1387                    : "r" (pnorun)
    1388                    : "$11" );
     1379    volatile unsigned int* pnorun = &psched->context[ltid].slot[CTX_NORUN_ID];
     1380    while (*pnorun == 0) _sys_pthread_yield();
    13891381
    13901382#if GIET_DEBUG_EXEC
Note: See TracChangeset for help on using the changeset viewer.