Index: trunk/kernel/libk/rwlock.c
===================================================================
--- trunk/kernel/libk/rwlock.c	(revision 603)
+++ trunk/kernel/libk/rwlock.c	(revision 610)
@@ -50,7 +50,7 @@
     busylock_init( &lock->lock , type );
 
-#if DEBUG_RWLOCK
+#if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+if( DEBUG_RWLOCK_TYPE == type )
 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid,
@@ -75,9 +75,10 @@
     {
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+uint32_t lock_type = lock->lock.type;
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
-lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
+lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
 #endif
         // register reader thread in waiting queue
@@ -100,9 +101,9 @@
     lock->count++;
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
-lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
+lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
 #endif
 
@@ -127,9 +128,10 @@
     {
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+uint32_t lock_type = lock->lock.type;
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
-lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
+lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
 #endif
         // register writer in waiting queue
@@ -152,9 +154,9 @@
     lock->taken = 1;
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
-lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
+lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
 #endif
 
@@ -176,10 +178,11 @@
     lock->count--;
 
-#if DEBUG_RWLOCK
+#if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+uint32_t lock_type = lock->lock.type;
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
-lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
+lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
 #endif
 
@@ -191,9 +194,9 @@
         thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list );
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
-lock_type_str[lock->lock.type], local_cxy, lock );
+lock_type_str[lock_type], local_cxy, lock );
 #endif
 
@@ -213,9 +216,9 @@
             thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list );
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
-lock_type_str[lock->lock.type], local_cxy, lock );
+lock_type_str[lock_type], local_cxy, lock );
 #endif
    
@@ -245,10 +248,11 @@
     lock->taken = 0;
 
-#if DEBUG_RWLOCK
+#if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+uint32_t lock_type = lock->lock.type;
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
-lock_type_str[lock->lock.type], local_cxy, lock, lock->taken, lock->count );
+lock_type_str[lock_type], local_cxy, lock, lock->taken, lock->count );
 #endif
 
@@ -259,9 +263,9 @@
         thread_t * thread = LIST_FIRST( &lock->wr_root , thread_t , wait_list );
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
-lock_type_str[lock->lock.type], local_cxy, lock );
+lock_type_str[lock_type], local_cxy, lock );
 #endif
         // remove this waiting thread from waiting list
@@ -280,9 +284,9 @@
             thread_t * thread = LIST_FIRST( &lock->rd_root , thread_t , wait_list );
 
-#if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+#if DEBUG_RWLOCK_TYPE
+if( DEBUG_RWLOCK_TYPE == lock_type )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
-lock_type_str[lock->lock.type], local_cxy, lock );
+lock_type_str[lock_type], local_cxy, lock );
 #endif
             // remove this waiting thread from waiting list
