Changeset 566 for trunk/kernel/syscalls/sys_wait.c
- Timestamp:
- Oct 4, 2018, 11:50:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_wait.c
r506 r566 25 25 #include <hal_uspace.h> 26 26 #include <hal_irqmask.h> 27 #include <remote_queuelock.h> 27 28 #include <core.h> 28 29 #include <thread.h> … … 95 96 xptr_t children_lock_xp = XPTR( owner_cxy , &process->children_lock ); 96 97 97 // exit this blockingloop only when a child processes change state98 // exit this loop only when a child processes change state 98 99 while( 1 ) 99 100 { … … 102 103 103 104 // get lock protecting children list 104 remote_ spinlock_lock( children_lock_xp );105 remote_queuelock_acquire( children_lock_xp ); 105 106 106 107 // scan the list of child process … … 113 114 114 115 // get PID, term_state, and main thread from child process 115 child_pid = hal_remote_l w(XPTR( child_cxy , &child_ptr->pid ));116 child_state = hal_remote_l w( XPTR(child_cxy , &child_ptr->term_state ) );116 child_pid = hal_remote_l32 (XPTR( child_cxy , &child_ptr->pid )); 117 child_state = hal_remote_l32 ( XPTR(child_cxy , &child_ptr->term_state ) ); 117 118 child_thread = hal_remote_lpt(XPTR( child_cxy , &child_ptr->th_tbl[0] )); 118 119 119 #if (DEBUG_SYS_WAIT & 1)120 #if (DEBUG_SYS_WAIT & 1) 120 121 cycle = hal_get_cycles(); 121 122 if( DEBUG_SYS_WAIT < cycle ) … … 130 131 ((child_state & PROCESS_TERM_WAIT) == 0) ) 131 132 { 132 // set the PROCESS_ FLAG_WAIT in child process descriptor133 // set the PROCESS_TERM_WAIT in child process descriptor 133 134 hal_remote_atomic_or( XPTR( child_cxy , &child_ptr->term_state ), 134 135 PROCESS_TERM_WAIT ); … … 140 141 141 142 // release lock protecting children list 142 remote_ spinlock_unlock( children_lock_xp );143 remote_queuelock_release( children_lock_xp ); 143 144 144 145 #if DEBUG_SYS_WAIT … … 163 164 } // end loop on children 164 165 166 // we execute this code when no child terminated: 167 // - release the lock protecting children list, 168 // - block on the WAIT condition 169 // - deschedule to keep waiting in the while loop 170 171 // release lock protecting children list 172 remote_queuelock_release( children_lock_xp ); 173 165 174 // block on WAIT condition 166 175 thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_WAIT ); 167 168 // release lock protecting children list169 remote_spinlock_unlock( children_lock_xp );170 176 171 177 #if (DEBUG_SYS_WAIT & 1)
Note: See TracChangeset
for help on using the changeset viewer.