Index: trunk/kernel/libk/remote_queuelock.c
===================================================================
--- trunk/kernel/libk/remote_queuelock.c	(revision 629)
+++ trunk/kernel/libk/remote_queuelock.c	(revision 666)
@@ -56,8 +56,10 @@
 #if DEBUG_QUEUELOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-if( (type     == DEBUG_QUEUELOCK_TYPE) &&
-    (lock_ptr == DEBUG_QUEUELOCK_PTR ) &&
-    (lock_cxy == DEBUG_QUEUELOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
+bool_t     cond = (type == DEBUG_QUEUELOCK_TYPE) &&
+                  (((lock_cxy == (cxy_t)DEBUG_QUEUELOCK_CXY) &&
+                    (lock_ptr == (remote_queuelock_t*)DEBUG_QUEUELOCK_PTR)) ||
+                   ((DEBUG_QUEUELOCK_CXY == 0) &&
+                    (DEBUG_QUEUELOCK_PTR == 0)));
+if( cond )printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid,
 lock_type_str[type], lock_cxy, lock_ptr );
@@ -70,7 +72,4 @@
 {
     thread_t * this = CURRENT_THREAD;
-
-    // check calling thread can yield
-    thread_assert_can_yield( this , __FUNCTION__ );
 
     // get lock cluster and local pointer 
@@ -78,6 +77,14 @@
     remote_queuelock_t * lock_ptr = GET_PTR( lock_xp );
 
-#if DEBUG_QUEUELOCK_TYPE
-uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+    // check calling thread can yield
+    thread_assert_can_yield( this , __FUNCTION__ );
+
+#if DEBUG_QUEUELOCK_TYPE
+uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+bool_t     cond = (lock_type == DEBUG_QUEUELOCK_TYPE) &&
+                  (((lock_cxy == (cxy_t)DEBUG_QUEUELOCK_CXY) &&
+                    (lock_ptr == (remote_queuelock_t*)DEBUG_QUEUELOCK_PTR)) ||
+                   ((DEBUG_QUEUELOCK_CXY == 0) &&
+                    (DEBUG_QUEUELOCK_PTR == 0)));
 #endif
 
@@ -93,8 +100,5 @@
 
 #if DEBUG_QUEUELOCK_TYPE
-if( (lock_type == DEBUG_QUEUELOCK_TYPE) &&
-    (lock_ptr  == DEBUG_QUEUELOCK_PTR ) &&
-    (lock_cxy  == DEBUG_QUEUELOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] BLOCK on q_lock %s [%x,%x]\n",
+if( cond ) printk("\n[%s] thread[%x,%x] BLOCK on q_lock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, 
 lock_type_str[lock_type], lock_cxy, lock_ptr );
@@ -121,8 +125,5 @@
 
 #if DEBUG_QUEUELOCK_TYPE
-if( (lock_type == DEBUG_QUEUELOCK_TYPE) &&
-    (lock_ptr  == DEBUG_QUEUELOCK_PTR ) &&
-    (lock_cxy  == DEBUG_QUEUELOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] ACQUIRE q_lock %s [%x,%x]\n",
+if( cond ) printk("\n[%s] thread[%x,%x] ACQUIRE q_lock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, 
 lock_type_str[lock_type], lock_cxy, lock_ptr );
@@ -149,4 +150,14 @@
     remote_queuelock_t * lock_ptr = GET_PTR( lock_xp );
 
+#if DEBUG_QUEUELOCK_TYPE
+thread_t * this      = CURRENT_THREAD;
+uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+bool_t     cond = (lock_type == DEBUG_QUEUELOCK_TYPE) &&
+                  (((lock_cxy == (cxy_t)DEBUG_QUEUELOCK_CXY) &&
+                    (lock_ptr == (remote_queuelock_t*)DEBUG_QUEUELOCK_PTR)) ||
+                   ((DEBUG_QUEUELOCK_CXY == 0) &&
+                    (DEBUG_QUEUELOCK_PTR == 0)));
+#endif
+
     // build extended pointer on busylock protecting queuelock
     xptr_t busylock_xp = XPTR( lock_cxy , &lock_ptr->lock );
@@ -156,10 +167,5 @@
 
 #if DEBUG_QUEUELOCK_TYPE
-thread_t * this      = CURRENT_THREAD;
-uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-if( (lock_type == DEBUG_QUEUELOCK_TYPE) &&
-    (lock_ptr  == DEBUG_QUEUELOCK_PTR ) &&
-    (lock_cxy  == DEBUG_QUEUELOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] RELEASE q_lock %s (%x,%x)\n",
+if( cond ) printk("\n[%s] thread[%x,%x] RELEASE q_lock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid,
 lock_type_str[lock_type], lock_cxy, lock_ptr );
@@ -179,7 +185,5 @@
 
 #if DEBUG_QUEUELOCK_TYPE
-if( (lock_type == DEBUG_QUEUELOCK_TYPE) &&
-    (lock_ptr  == DEBUG_QUEUELOCK_PTR ) &&
-    (lock_cxy  == DEBUG_QUEUELOCK_CXY ) )
+if( cond )
 {
     trdid_t     trdid   = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
