Index: trunk/kernel/libk/remote_rwlock.c
===================================================================
--- trunk/kernel/libk/remote_rwlock.c	(revision 563)
+++ trunk/kernel/libk/remote_rwlock.c	(revision 600)
@@ -1,4 +1,4 @@
 /*
- * remote_rwlock.c - kernel remote rwlock implementation.
+ * remote_rwlock.c - kernel remote read/write lock implementation.
  * 
  * Authors    Alain   Greiner (2016,2017,2018)
@@ -66,4 +66,8 @@
     cxy_t             lock_cxy = GET_CXY( lock_xp );
 
+#if DEBUG_RWLOCK
+uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+#endif
+
     // build useful extended pointers
     xptr_t busylock_xp = XPTR( lock_cxy , &lock_ptr->lock );
@@ -81,10 +85,7 @@
 #if DEBUG_RWLOCK
 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
-{
-    uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    printk("\n[DBG] %s : thread %x (%s) READ BLOCK on rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type),
-    lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
-}
+printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x]\n",
+__FUNCTION__, this->process->pid, this->trdid, 
+lock_type_str[lock_type], lock_cxy, lock_ptr );
 #endif
         // get pointer on calling thread
@@ -109,10 +110,7 @@
 #if DEBUG_RWLOCK
 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
-{
-    uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    printk("\n[DBG] %s : thread %x (%s) READ ACQUIRE on rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type),
-    lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
-}
+printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x]\n",
+__FUNCTION__, this->process->pid, this->trdid,
+lock_type_str[lock_type], lock_cxy, lock_ptr );
 #endif
 
@@ -136,4 +134,8 @@
     remote_rwlock_t * lock_ptr = GET_PTR( lock_xp );
     cxy_t             lock_cxy = GET_CXY( lock_xp );
+
+#if DEBUG_RWLOCK
+uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+#endif
 
     // build useful extended pointers
@@ -152,10 +154,7 @@
 #if DEBUG_RWLOCK
 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
-{
-    uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    printk("\n[DBG] %s : thread %x (%s) WRITE BLOCK on rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type),
-    lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
-}
+printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x]\n",
+__FUNCTION__, this->process->pid, this->trdid, 
+lock_type_str[lock_type], lock_cxy, lock_ptr );
 #endif
         // get local pointer on calling thread
@@ -180,10 +179,7 @@
 #if DEBUG_RWLOCK
 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
-{
-    uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    printk("\n[DBG] %s : thread %x (%s) WRITE ACQUIRE on rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type),
-    lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
-}
+printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x]\n",
+__FUNCTION__, this->process->pid, this->trdid, 
+lock_type_str[lock_type], lock_cxy, lock_ptr );
 #endif
 
@@ -217,12 +213,10 @@
 
 #if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
-{
-    thread_t * this = CURRENT_THREAD;
-    uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    printk("\n[DBG] %s : thread %x (%s) READ RELEASE on rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type),
-    lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
-}
+thread_t * this      = CURRENT_THREAD;
+uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x]\n",
+__FUNCTION__, this->process->pid, this->trdid,
+lock_type_str[lock_type], lock_cxy, lock_ptr );
 #endif
 
@@ -248,12 +242,10 @@
 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
 {
-    thread_t  * this        = CURRENT_THREAD;
-    uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
-    uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
-    printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
-    " / rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 
-    lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
+    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
+    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
+    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
+    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
+    __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 
+    lock_type_str[lock_type], lock_cxy, lock_ptr );
 }
 #endif
@@ -281,12 +273,10 @@
 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
 {
-    thread_t  * this        = CURRENT_THREAD;
-    uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
-    uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
-    printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
-    " / rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 
-    lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
+    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
+    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
+    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
+    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
+    __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 
+    lock_type_str[lock_type], lock_cxy, lock_ptr );
 }
 #endif
@@ -320,12 +310,10 @@
 
 #if DEBUG_RWLOCK
-if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
-{
-    thread_t * this = CURRENT_THREAD;
-    uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    printk("\n[DBG] %s : thread %x (%s) WRITE RELEASE on rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type),
-    lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
-}
+thread_t * this      = CURRENT_THREAD;
+uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
+printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x]\n",
+__FUNCTION__, this->process->pid, this->trdid,
+lock_type_str[lock_type], lock_cxy, lock_ptr );
 #endif
 
@@ -350,12 +338,10 @@
 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
 {
-    thread_t  * this        = CURRENT_THREAD;
-    uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
-    uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
-    printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
-    " / rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 
-    lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
+    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
+    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
+    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
+    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
+    __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 
+    lock_type_str[lock_type], lock_cxy, lock_ptr );
 }
 #endif
@@ -382,12 +368,10 @@
 if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
 {
-    thread_t  * this        = CURRENT_THREAD;
-    uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
-    trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
-    uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
-    printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
-    " / rwlock %s [%x,%x] / cycle %d\n",
-    __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type), 
-    lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
+    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
+    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
+    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
+    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
+    __FUNCTION__, this->process->pid, this->trdid, pid, trdid, 
+    lock_type_str[lock_type], lock_cxy, lock_ptr );
 }
 #endif
