Ignore:
Timestamp:
May 16, 2018, 4:15:22 PM (7 years ago)
Author:
alain
Message:

Fix few bugs whike debugging the sort multi-thread application.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_thread_cancel.c

    r440 r443  
    3737    cxy_t        target_cxy;    // target thread cluster identifier
    3838    ltid_t       target_ltid;   // target thread local index
     39    xptr_t       owner_xp;      // extended pointer on owner process
    3940    cxy_t        owner_cxy;     // process owner cluster identifier
    40     xptr_t       owner_xp;      // extended pointer on owner process
    4141
    4242    // get killer thread pointers
     
    4444    process_t  * process = this->process;
    4545    pid_t        pid     = process->pid;
     46
     47#if DEBUG_SYS_THREAD_CANCEL
     48uint64_t     tm_start;
     49uint64_t     tm_end;
     50tm_start = hal_get_cycles();
     51if( DEBUG_SYS_THREAD_CANCEL < tm_start )
     52printk("\n[DBG] %s : thread %x enter to kill thread %x in process %x / cycle %d\n",
     53__FUNCTION__, this , trdid , pid , (uint32_t)tm_start );
     54#endif
    4655
    4756    // get extended pointer on target thread
     
    5968    }
    6069
    61 #if DEBUG_SYS_THREAD_CANCEL
    62 uint64_t     tm_start;
    63 uint64_t     tm_end;
    64 tm_start = hal_get_cycles();
    65 if( DEBUG_SYS_THREAD_CANCEL < tm_start )
    66 printk("\n[DBG] %s : thread %x enter to kill thread %x / cycle %d\n",
    67 __FUCTION__, this, GET_PTR( target_xp ), (uint32_t)tm_start );
    68 #endif
    69 
    70     // get process owner cluster identifier
    71     owner_cxy = CXY_FROM_PID( pid );
     70    // get process owner cluster
     71    owner_xp  = process->owner_xp;
     72    owner_cxy = GET_CXY( owner_xp );
    7273
    7374    // get target thread ltid and cluster
     
    7980    if( (target_cxy == owner_cxy) && (target_ltid == 0) )
    8081    {
    81         // get extended pointer on owner cluster
    82         owner_xp = cluster_get_owner_process_from_pid( pid );
    83 
    8482        // mark for delete all threads but the main
    8583        hal_enable_irq( &save_sr );
     
    107105tm_end = hal_get_cycles();
    108106if( DEBUG_SYS_THREAD_CANCEL < tm_end )
    109 printk("\n[DBG] %s : thread %x exit after kill thread %x / cycle %d\n",
    110 __FUCTION__, this, GET_PTR( target_xp ), (uint32_t)tm_end );
     107printk("\n[DBG] %s : thread %x exit after kill thread %x in process %x / cycle %d\n",
     108__FUNCTION__, this , trdid , pid , (uint32_t)tm_end );
    111109#endif
    112110
Note: See TracChangeset for help on using the changeset viewer.