Changeset 584 for trunk/kernel/syscalls/sys_thread_join.c
- Timestamp:
- Nov 1, 2018, 12:13:45 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_thread_join.c
r566 r584 67 67 tm_start = hal_get_cycles(); 68 68 if( 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 ); 69 printk("\n[DBG] %s : joining thread[%x,%x] enter / target thread[%x,%x] / cycle %d\n", 70 __FUNCTION__ , process->pid, joining_ptr->trdid, 71 process->pid, trdid, (uint32_t)tm_start ); 71 72 #endif 72 73 73 74 // 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) ) 75 76 { 76 77 77 78 #if DEBUG_SYSCALLS_ERROR 78 printk("\n[ERROR] in %s : illegal trdid argument %x\n", __FUNCTION__, trdid ); 79 printk("\n[ERROR] in %s : illegal trdid argument %x\n", 80 __FUNCTION__, trdid ); 79 81 #endif 80 82 joining_ptr->errno = EINVAL; … … 87 89 88 90 #if DEBUG_SYSCALLS_ERROR 89 printk("\n[ERROR] in %s : exit_value argument must be NULL\n", __FUNCTION__ ); 91 printk("\n[ERROR] in %s : exit_value argument must be NULL\n", 92 __FUNCTION__ ); 90 93 #endif 91 94 joining_ptr->errno = EINVAL; … … 113 116 114 117 #if DEBUG_SYSCALLS_ERROR 115 printk("\n[ERROR] in %s : target thread %x not found\n", __FUNCTION__, trdid ); 118 printk("\n[ERROR] in %s : target thread %x not found\n", 119 __FUNCTION__, trdid ); 116 120 #endif 117 121 joining_ptr->errno = ESRCH; … … 145 149 if( hal_remote_l32( target_flags_xp ) & THREAD_FLAG_KILL_DONE ) // killer thread is first 146 150 { 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 #endif153 151 // get pointers on killer thread 154 152 killer_xp = (xptr_t)hal_remote_l64( target_join_xp_xp ); … … 163 161 remote_busylock_release( target_join_lock_xp ); 164 162 165 // restore IRQs 166 hal_restore_irq( save_sr ); 163 #if DEBUG_SYS_THREAD_JOIN 164 tm_end = hal_get_cycles(); 165 if( DEBUG_SYS_THREAD_JOIN < tm_end ) 166 printk("\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 167 170 } 168 171 else // joining thread is first 169 172 { 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 #endif176 173 // set the join_done flag in target thread 177 174 hal_remote_atomic_or( target_flags_xp , THREAD_FLAG_JOIN_DONE ); … … 186 183 remote_busylock_release( target_join_lock_xp ); 187 184 188 #if (DEBUG_SYS_THREAD_JOIN & 1)185 #if DEBUG_SYS_THREAD_JOIN 189 186 if( 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 );187 printk("\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 ); 192 189 #endif 193 190 // deschedule 194 191 sched_yield( "joining thread waiting killer thread" ); 195 192 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 206 194 tm_end = hal_get_cycles(); 207 195 if( 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 196 printk("\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 ); 211 204 212 205 return 0;
Note: See TracChangeset
for help on using the changeset viewer.