Ignore:
Timestamp:
Jun 26, 2017, 3:15:11 PM (4 years ago)
Author:
alain
Message:

bloup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/remote_rwlock.c

    r23 r50  
    2626#include <hal_irqmask.h>
    2727#include <thread.h>
     28#include <printk.h>
    2829#include <cluster.h>
    2930#include <scheduler.h>
     
    185186
    186187    // compute extended pointers on lock->ticket, lock->owner and thread->remote_locks
    187     xptr_t              current_xp = XPTR( lock_cxy   , &lock_ptr->ticket );
     188    xptr_t              current_xp = XPTR( lock_cxy   , &lock_ptr->current );
    188189    xptr_t              owner_xp   = XPTR( lock_cxy   , &lock_ptr->owner );
    189190    xptr_t              locks_xp   = XPTR( thread_cxy , &thread_ptr->remote_locks );
     
    202203}  // end remote_rwlock_wr_unlock()
    203204
    204 
     205///////////////////////////////////////////
     206void remote_rwlock_print( xptr_t   lock_xp,
     207                          char   * comment )
     208{
     209    uint32_t     ticket;                // first free ticket index
     210    uint32_t     current;               // ticket index of current owner
     211    uint32_t     count;                 // current number of reader threads
     212    xptr_t       owner;                 // extended pointer on writer thread
     213
     214    // get cluster and local pointer on remote_rwlock
     215    remote_rwlock_t * lock_ptr = (remote_rwlock_t *)GET_PTR( lock_xp );
     216    cxy_t             lock_cxy = GET_CXY( lock_xp );
     217
     218    ticket  = hal_remote_lw ( XPTR( lock_cxy , &lock_ptr->ticket ) );
     219    current = hal_remote_lw ( XPTR( lock_cxy , &lock_ptr->current ) );
     220    count   = hal_remote_lw ( XPTR( lock_cxy , &lock_ptr->count ) );
     221    owner   = hal_remote_lwd( XPTR( lock_cxy , &lock_ptr->owner ) );
     222
     223    printk("\n*** rwlock <%l> %s : ticket = %d / current = %d / count = %d / owner = %l\n",
     224           lock_xp , comment , ticket , current , count , owner );
     225
     226}  // end remote_rwlock_print()
     227
Note: See TracChangeset for help on using the changeset viewer.