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

Introduce sys_place_fork() function.

File:
1 edited

Legend:

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

    r566 r584  
    3838int sys_exit( uint32_t status )
    3939{
    40     reg_t       save_sr;           // required to enable IRQs
    41 
    4240    xptr_t      owner_xp;          // extended pointer on owner process
    4341    cxy_t       owner_cxy;         // owner process cluster
     
    6058tm_start = hal_get_cycles();
    6159if( DEBUG_SYS_EXIT < tm_start )
    62 printk("\n[DBG] %s : thread %x in process %x enter / status %x / cycle %d\n",
    63 __FUNCTION__, this->trdid, process->pid , status , (uint32_t)tm_start );
     60printk("\n[DBG] %s : thread[%x,%x] enter / status %x / cycle %d\n",
     61__FUNCTION__, process->pid, this->trdid , status , (uint32_t)tm_start );
    6462#endif
    6563
     
    7169#if (DEBUG_SYS_EXIT & 1)
    7270if( DEBUG_SYS_EXIT < tm_start )
    73 printk("\n[DBG] %s : thread %x in process %x get owner process in cluster %x\n",
    74 __FUNCTION__, this->trdid, process->pid, owner_cxy );
     71printk("\n[DBG] %s : thread[%x,%x] get owner process in cluster %x\n",
     72__FUNCTION__, process->pid, this->trdid, owner_cxy );
    7573#endif
    7674
     
    8583#if (DEBUG_SYS_EXIT & 1)
    8684if( DEBUG_SYS_EXIT < tm_start )
    87 printk("\n[DBG] %s : thread %x in process %x get parent process in cluster %x\n",
    88 __FUNCTION__, this->trdid, process->pid, parent_cxy );
     85printk("\n[DBG] %s : thread[%x,%x] get parent process in cluster %x\n",
     86__FUNCTION__, process->pid, this->trdid, parent_cxy );
    8987#endif
    9088
     
    9896#if( DEBUG_SYS_EXIT & 1)
    9997if( DEBUG_SYS_EXIT < tm_start )
    100 printk("\n[DBG] %s : thread %x in process %x detached process from TXT\n",
    101 __FUNCTION__, this->trdid, process->pid );
     98printk("\n[DBG] %s : thread[%x,%x] detached process from TXT\n",
     99__FUNCTION__, process->pid, this->trdid );
    102100#endif
    103101
    104102    // mark for delete all process threads in all clusters,
    105103    // but the main thread and this calling thread
    106     hal_enable_irq( &save_sr );
    107104    process_sigaction( process->pid , DELETE_ALL_THREADS );
    108     hal_restore_irq( save_sr );
    109105
    110106#if( DEBUG_SYS_EXIT & 1)
    111107if( DEBUG_SYS_EXIT < tm_start )
    112 printk("\n[DBG] %s : thread %x in process %x deleted all threads but itself\n",
    113 __FUNCTION__, this->trdid, process->pid );
     108printk("\n[DBG] %s : thread[%x,%x] deleted all threads but itself\n",
     109__FUNCTION__, process->pid, this->trdid );
    114110#endif
    115111
     
    120116#if( DEBUG_SYS_EXIT & 1)
    121117if( tm_start > DEBUG_SYS_EXIT )
    122 printk("\n[DBG] %s : thread %x in process %x marked iself for delete\n",
    123 __FUNCTION__, this->trdid, process->pid );
     118printk("\n[DBG] %s : thread[%x,%x] marked iself for delete\n",
     119__FUNCTION__, process->pid, this->trdid );
    124120#endif
    125121        thread_delete( XPTR( local_cxy , this ) , pid , true );
     
    131127#if( DEBUG_SYS_EXIT & 1)
    132128if( tm_start > DEBUG_SYS_EXIT )
    133 printk("\n[DBG] %s : thread %x in process %x blocked main thread\n",
    134 __FUNCTION__, this->trdid, process->pid );
     129printk("\n[DBG] %s : thread[%x,%x] blocked main thread\n",
     130__FUNCTION__, process->pid, this->trdid );
    135131#endif
    136132
     
    142138#if( DEBUG_SYS_EXIT & 1)
    143139if( tm_start > DEBUG_SYS_EXIT )
    144 printk("\n[DBG] %s : thread %x in process %x set exit status %x in owner process\n",
    145 __FUNCTION__, this->trdid, process->pid, term_state );
     140printk("\n[DBG] %s : thread[%x,%x] set exit status %x in owner process\n",
     141__FUNCTION__, process->pid, this->trdid, term_state );
    146142#endif
    147143
     
    151147#if( DEBUG_SYS_EXIT & 1)
    152148if( tm_start > DEBUG_SYS_EXIT )
    153 printk("\n[DBG] %s : thread %x in process %x unblocked parent main thread in process %x\n",
    154 __FUNCTION__ , this->trdid, process->pid,
     149printk("\n[DBG] %s : thread[%x,%x] unblocked parent main thread in process %x\n",
     150__FUNCTION__ , process->pid, this->trdid,
    155151hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid) ) );
    156152#endif
     
    161157tm_end = hal_get_cycles();
    162158if( DEBUG_SYS_EXIT < tm_end )
    163 printk("\n[DBG] %s : thread %x in process %x exit / status %x / cost = %d / cycle %d\n",
    164 __FUNCTION__, this->trdid, process->pid, status,
     159printk("\n[DBG] %s : thread[%x,%x] exit / status %x / cost = %d / cycle %d\n",
     160__FUNCTION__, process->pid, this->trdid, status,
    165161(uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
    166162#endif
Note: See TracChangeset for help on using the changeset viewer.