Ignore:
Timestamp:
Nov 1, 2018, 12:13:45 PM (6 years ago)
Author:
alain
Message:

Introduce sys_place_fork() function.

File:
1 edited

Legend:

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

    r566 r584  
    6767tm_start = hal_get_cycles();
    6868if( DEBUG_SYS_THREAD_JOIN < tm_start )
    69 printk("\n[DBG] %s : thread %x in process %x enter / target thread %x / cycle %d\n",
    70 __FUNCTION__ , joining_ptr->trdid, process->pid, trdid , (uint32_t)tm_start );
     69printk("\n[DBG] %s : joining thread[%x,%x] enter / target thread[%x,%x] / cycle %d\n",
     70__FUNCTION__ , process->pid, joining_ptr->trdid,
     71process->pid, trdid, (uint32_t)tm_start );
    7172#endif
    7273
    7374    // check trdid argument
    74         if( (target_ltid >= CONFIG_THREADS_MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) ) 
     75        if( (target_ltid >= CONFIG_THREADS_MAX_PER_CLUSTER) || cluster_is_undefined(target_cxy) )
    7576        {
    7677
    7778#if DEBUG_SYSCALLS_ERROR
    78 printk("\n[ERROR] in %s : illegal trdid argument %x\n", __FUNCTION__, trdid );
     79printk("\n[ERROR] in %s : illegal trdid argument %x\n",
     80__FUNCTION__, trdid );
    7981#endif
    8082                joining_ptr->errno = EINVAL;
     
    8789
    8890#if DEBUG_SYSCALLS_ERROR
    89 printk("\n[ERROR] in %s : exit_value argument must be NULL\n", __FUNCTION__ );
     91printk("\n[ERROR] in %s : exit_value argument must be NULL\n",
     92__FUNCTION__ );
    9093#endif
    9194                joining_ptr->errno = EINVAL;
     
    113116
    114117#if DEBUG_SYSCALLS_ERROR
    115 printk("\n[ERROR] in %s : target thread %x not found\n", __FUNCTION__, trdid );
     118printk("\n[ERROR] in %s : target thread %x not found\n",
     119__FUNCTION__, trdid );
    116120#endif
    117121        joining_ptr->errno = ESRCH;
     
    145149    if( hal_remote_l32( target_flags_xp ) & THREAD_FLAG_KILL_DONE )  // killer thread is first
    146150    {
    147 
    148 #if (DEBUG_SYS_THREAD_JOIN & 1)
    149 if( DEBUG_SYS_THREAD_JOIN < tm_start )
    150 printk("\n[DBG] %s : thread %x in process %x / killer thread arrived first\n",
    151 __FUNCTION__ , joining_ptr->trdid, process->pid );
    152 #endif
    153151        // get pointers on killer thread
    154152        killer_xp  = (xptr_t)hal_remote_l64( target_join_xp_xp );
     
    163161        remote_busylock_release( target_join_lock_xp );
    164162
    165         // restore IRQs
    166         hal_restore_irq( save_sr );
     163#if DEBUG_SYS_THREAD_JOIN
     164tm_end = hal_get_cycles();
     165if( DEBUG_SYS_THREAD_JOIN < tm_end )
     166printk("\n[DBG] %s : joining thread[%x,%x] exit / target thread[%x,%x] completed / cycle %d\n",
     167__FUNCTION__, process->pid, joining_ptr->trdid, process->pid, trdid, (uint32_t)tm_end );
     168#endif
     169
    167170    }
    168171    else                                                          // joining thread is first
    169172    {
    170 
    171 #if (DEBUG_SYS_THREAD_JOIN & 1)
    172 if( DEBUG_SYS_THREAD_JOIN < tm_start )
    173 printk("\n[DBG] %s : thread %x in process %x / joining thread arrived first\n",
    174 __FUNCTION__ , joining_ptr->trdid, process->pid );
    175 #endif
    176173        // set the join_done flag in target thread
    177174        hal_remote_atomic_or( target_flags_xp , THREAD_FLAG_JOIN_DONE );
     
    186183        remote_busylock_release( target_join_lock_xp );
    187184
    188 #if (DEBUG_SYS_THREAD_JOIN & 1)
     185#if DEBUG_SYS_THREAD_JOIN
    189186if( DEBUG_SYS_THREAD_JOIN < tm_start )
    190 printk("\n[DBG] %s : thread %x in process %x / joining thread deschedule\n",
    191 __FUNCTION__ , joining_ptr->trdid, process->pid );
     187printk("\n[DBG] %s : joining thread[%x,%x] deschedules / target thread[%x,%x] not completed\n",
     188__FUNCTION__ , process->pid, joining_ptr->trdid, process->pid, trdid );
    192189#endif
    193190        // deschedule
    194191        sched_yield( "joining thread waiting killer thread" );
    195192   
    196 #if (DEBUG_SYS_THREAD_JOIN & 1)
    197 if( DEBUG_SYS_THREAD_JOIN < tm_start )
    198 printk("\n[DBG] %s : thread %x in process %x / joining thread resume\n",
    199 __FUNCTION__ , joining_ptr->trdid, process->pid );
    200 #endif
    201         // restore IRQs
    202         hal_restore_irq( save_sr );
    203     }
    204 
    205 #if DEBUG_SYS_THREAD_JOIN
     193#if DEBUG_SYS_THREAD_JOIN
    206194tm_end = hal_get_cycles();
    207195if( DEBUG_SYS_THREAD_JOIN < tm_end )
    208 printk("\n[DBG] %s : thread %x in process %x exit / target thread %x / cycle %d\n",
    209 __FUNCTION__, joining_ptr->trdid, process->pid, (uint32_t)tm_end );
    210 #endif
     196printk("\n[DBG] %s : joining thread[%x,%x] exit / target thread[%x,%x] completed / cycle %d\n",
     197__FUNCTION__ , process->pid, joining_ptr->trdid, process->pid, trdid, (uint32_t)tm_end );
     198#endif
     199
     200    }
     201
     202    // restore IRQs
     203    hal_restore_irq( save_sr );
    211204
    212205    return 0;
Note: See TracChangeset for help on using the changeset viewer.