Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/bits/locks.h

    rb158d8f r2e9aed4  
    5858
    5959#ifdef __cforall
     60        extern "C" {
     61                extern void disable_interrupts();
     62                extern void enable_interrupts_noPoll();
     63        }
     64
    6065        extern void yield( unsigned int );
    6166        extern thread_local struct thread_desc *    volatile this_thread;
     67        extern thread_local struct processor *      volatile this_processor;
    6268
    6369        static inline void ?{}( __spinlock_t & this ) {
     
    6874        static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    6975                _Bool result = __lock_test_and_test_and_set( this.lock );
    70                 __cfaabi_dbg_debug_do(
    71                         if( result ) {
     76                if( result ) {
     77                        disable_interrupts();
     78                        __cfaabi_dbg_debug_do(
    7279                                this.prev_name = caller;
    7380                                this.prev_thrd = this_thread;
    74                         }
    75                 )
     81                        )
     82                }
    7683                return result;
    7784        }
     
    99106                        #endif
    100107                }
     108                disable_interrupts();
    101109                __cfaabi_dbg_debug_do(
    102110                        this.prev_name = caller;
     
    105113        }
    106114
    107         // Lock the spinlock, spin if already acquired
    108         static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    109                 for ( unsigned int i = 1;; i += 1 ) {
    110                         if ( __lock_test_and_test_and_set( this.lock ) ) break;
    111                         yield( i );
    112                 }
    113                 __cfaabi_dbg_debug_do(
    114                         this.prev_name = caller;
    115                         this.prev_thrd = this_thread;
    116                 )
    117         }
     115        // // Lock the spinlock, yield if already acquired
     116        // static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
     117        //      for ( unsigned int i = 1;; i += 1 ) {
     118        //              if ( __lock_test_and_test_and_set( this.lock ) ) break;
     119        //              yield( i );
     120        //      }
     121        //      disable_interrupts();
     122        //      __cfaabi_dbg_debug_do(
     123        //              this.prev_name = caller;
     124        //              this.prev_thrd = this_thread;
     125        //      )
     126        // }
    118127
    119128        static inline void unlock( __spinlock_t & this ) {
     129                enable_interrupts_noPoll();
    120130                __lock_release( this.lock );
    121131        }
Note: See TracChangeset for help on using the changeset viewer.