Changeset 610 for trunk/kernel/libk/rwlock.c
- Timestamp:
- Dec 27, 2018, 7:38:58 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/rwlock.c
r603 r610 50 50 busylock_init( &lock->lock , type ); 51 51 52 #if DEBUG_RWLOCK 52 #if DEBUG_RWLOCK_TYPE 53 53 thread_t * this = CURRENT_THREAD; 54 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())54 if( DEBUG_RWLOCK_TYPE == type ) 55 55 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n", 56 56 __FUNCTION__, this->process->pid, this->trdid, … … 75 75 { 76 76 77 #if DEBUG_RWLOCK 78 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 77 #if DEBUG_RWLOCK_TYPE 78 uint32_t lock_type = lock->lock.type; 79 if( DEBUG_RWLOCK_TYPE == lock_type ) 79 80 printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n", 80 81 __FUNCTION__, this->process->pid, this->trdid, 81 lock_type_str[lock ->lock.type], local_cxy, lock, lock->taken, lock->count );82 lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count ); 82 83 #endif 83 84 // register reader thread in waiting queue … … 100 101 lock->count++; 101 102 102 #if DEBUG_RWLOCK 103 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())103 #if DEBUG_RWLOCK_TYPE 104 if( DEBUG_RWLOCK_TYPE == lock_type ) 104 105 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n", 105 106 __FUNCTION__, this->process->pid, this->trdid, 106 lock_type_str[lock ->lock.type], local_cxy, lock, lock->taken, lock->count );107 lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count ); 107 108 #endif 108 109 … … 127 128 { 128 129 129 #if DEBUG_RWLOCK 130 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 130 #if DEBUG_RWLOCK_TYPE 131 uint32_t lock_type = lock->lock.type; 132 if( DEBUG_RWLOCK_TYPE == lock_type ) 131 133 printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n", 132 134 __FUNCTION__, this->process->pid, this->trdid, 133 lock_type_str[lock ->lock.type], local_cxy, lock, lock->taken, lock->count );135 lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count ); 134 136 #endif 135 137 // register writer in waiting queue … … 152 154 lock->taken = 1; 153 155 154 #if DEBUG_RWLOCK 155 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())156 #if DEBUG_RWLOCK_TYPE 157 if( DEBUG_RWLOCK_TYPE == lock_type ) 156 158 printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n", 157 159 __FUNCTION__, this->process->pid, this->trdid, 158 lock_type_str[lock ->lock.type], local_cxy, lock, lock->taken, lock->count );160 lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count ); 159 161 #endif 160 162 … … 176 178 lock->count--; 177 179 178 #if DEBUG_RWLOCK 180 #if DEBUG_RWLOCK_TYPE 179 181 thread_t * this = CURRENT_THREAD; 180 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 182 uint32_t lock_type = lock->lock.type; 183 if( DEBUG_RWLOCK_TYPE == lock_type ) 181 184 printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n", 182 185 __FUNCTION__, this->process->pid, this->trdid, 183 lock_type_str[lock ->lock.type], local_cxy, lock, lock->taken, lock->count );186 lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count ); 184 187 #endif 185 188 … … 191 194 thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list ); 192 195 193 #if DEBUG_RWLOCK 194 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())196 #if DEBUG_RWLOCK_TYPE 197 if( DEBUG_RWLOCK_TYPE == lock_type ) 195 198 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 196 199 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, 197 lock_type_str[lock ->lock.type], local_cxy, lock );200 lock_type_str[lock_type], local_cxy, lock ); 198 201 #endif 199 202 … … 213 216 thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list ); 214 217 215 #if DEBUG_RWLOCK 216 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())218 #if DEBUG_RWLOCK_TYPE 219 if( DEBUG_RWLOCK_TYPE == lock_type ) 217 220 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 218 221 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, 219 lock_type_str[lock ->lock.type], local_cxy, lock );222 lock_type_str[lock_type], local_cxy, lock ); 220 223 #endif 221 224 … … 245 248 lock->taken = 0; 246 249 247 #if DEBUG_RWLOCK 250 #if DEBUG_RWLOCK_TYPE 248 251 thread_t * this = CURRENT_THREAD; 249 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() ) 252 uint32_t lock_type = lock->lock.type; 253 if( DEBUG_RWLOCK_TYPE == lock_type ) 250 254 printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n", 251 255 __FUNCTION__, this->process->pid, this->trdid, 252 lock_type_str[lock ->lock.type], local_cxy, lock, lock->taken, lock->count );256 lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count ); 253 257 #endif 254 258 … … 259 263 thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list ); 260 264 261 #if DEBUG_RWLOCK 262 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())265 #if DEBUG_RWLOCK_TYPE 266 if( DEBUG_RWLOCK_TYPE == lock_type ) 263 267 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 264 268 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, 265 lock_type_str[lock ->lock.type], local_cxy, lock );269 lock_type_str[lock_type], local_cxy, lock ); 266 270 #endif 267 271 // remove this waiting thread from waiting list … … 280 284 thread_t * thread = LIST_FIRST( &lock->rd_root , thread_t , wait_list ); 281 285 282 #if DEBUG_RWLOCK 283 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles())286 #if DEBUG_RWLOCK_TYPE 287 if( DEBUG_RWLOCK_TYPE == lock_type ) 284 288 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n", 285 289 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid, 286 lock_type_str[lock ->lock.type], local_cxy, lock );290 lock_type_str[lock_type], local_cxy, lock ); 287 291 #endif 288 292 // remove this waiting thread from waiting list
Note: See TracChangeset
for help on using the changeset viewer.