Changeset 318 for trunk/kernel
- Timestamp:
- Aug 4, 2017, 4:22:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_rwlock.c
r124 r318 54 54 55 55 // get cluster and local pointer on local thread 56 cxy_t thread_cxy = local_cxy; 57 thread_t * thread_ptr = CURRENT_THREAD; 58 59 // extended pointers on ticket, current, count, and thread->remote_locks 56 thread_t * thread_ptr = CURRENT_THREAD; 57 58 // extended pointers on ticket, current, count 60 59 xptr_t ticket_xp = XPTR( lock_cxy , &lock_ptr->ticket ); 61 60 xptr_t current_xp = XPTR( lock_cxy , &lock_ptr->current ); 62 61 xptr_t count_xp = XPTR( lock_cxy , &lock_ptr->count ); 63 xptr_t locks_xp = XPTR( thread_cxy , &thread_ptr->remote_locks );64 62 65 63 // disable interrupts … … 77 75 ////////// From here we have the lock //////////// 78 76 79 // increment count and thead.remote_locks77 // increment count 80 78 hal_remote_atomic_add( count_xp , 1 ); 81 hal_remote_atomic_add( locks_xp , 1 ); 79 80 // increment thread.remote_locks 81 thread_ptr->remote_locks++; 82 82 83 83 // sync … … 102 102 103 103 // get cluster and local pointer on local thread 104 cxy_t thread_cxy = local_cxy; 105 thread_t * thread_ptr = CURRENT_THREAD; 106 107 // extended pointers on lock->count and thread->remote_locks 104 thread_t * thread_ptr = CURRENT_THREAD; 105 106 // extended pointers on lock->count 108 107 xptr_t count_xp = XPTR( lock_cxy , &lock_ptr->count ); 109 xptr_t locks_xp = XPTR( thread_cxy , &thread_ptr->remote_locks );110 108 111 109 // disable interrupts 112 110 hal_disable_irq( &mode ); 113 111 114 // decrement count and thread.remote_locks112 // decrement count 115 113 hal_remote_atomic_add( count_xp , -1 ); 116 hal_remote_atomic_add( locks_xp , -1 ); 114 115 // decrement thread.remote_locks 116 thread_ptr->remote_locks--; 117 117 118 118 // enable interrupts … … 135 135 thread_t * thread_ptr = CURRENT_THREAD; 136 136 137 // compute extended pointers on lock->ticket, lock->owner , and thread->remote_locks137 // compute extended pointers on lock->ticket, lock->owner 138 138 xptr_t ticket_xp = XPTR( lock_cxy , &lock_ptr->ticket ); 139 139 xptr_t count_xp = XPTR( lock_cxy , &lock_ptr->count ); 140 140 xptr_t current_xp = XPTR( lock_cxy , &lock_ptr->current ); 141 141 xptr_t owner_xp = XPTR( lock_cxy , &lock_ptr->owner ); 142 xptr_t locks_xp = XPTR( thread_cxy , &thread_ptr->remote_locks );143 142 xptr_t thread_xp = XPTR( thread_cxy , thread_ptr ); 144 143 … … 163 162 } 164 163 165 // register owner thread and increment thread.remote_locks164 // register owner thread 166 165 hal_remote_swd( owner_xp , thread_xp ); 167 hal_remote_atomic_add( locks_xp , 1 ); 166 167 // increment thread.remote_locks 168 thread_ptr->remote_locks++; 168 169 169 170 // enable interrupts … … 182 183 183 184 // get cluster and local pointer on local thread 184 cxy_t thread_cxy = local_cxy; 185 thread_t * thread_ptr = CURRENT_THREAD; 186 187 // compute extended pointers on lock->ticket, lock->owner and thread->remote_locks 185 thread_t * thread_ptr = CURRENT_THREAD; 186 187 // compute extended pointers on lock->ticket, lock->owner 188 188 xptr_t current_xp = XPTR( lock_cxy , &lock_ptr->current ); 189 189 xptr_t owner_xp = XPTR( lock_cxy , &lock_ptr->owner ); 190 xptr_t locks_xp = XPTR( thread_cxy , &thread_ptr->remote_locks );191 190 192 191 // disable interrupts … … 196 195 hal_remote_swd( owner_xp , XPTR_NULL ); 197 196 hal_remote_atomic_add( current_xp , 1 ); 198 hal_remote_atomic_add( locks_xp , -1 ); 197 198 // decrement thread.remote_locks 199 thread_ptr->remote_locks--; 199 200 200 201 // enable interrupts
Note: See TracChangeset
for help on using the changeset viewer.