Ignore:
Timestamp:
Jan 30, 2018, 2:04:27 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
ffd0ac2
Parents:
813ddcaa
Message:

Fixed non-preemptive locks

File:
1 edited

Legend:

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

    r813ddcaa r2e9aed4  
    6565        extern void yield( unsigned int );
    6666        extern thread_local struct thread_desc *    volatile this_thread;
     67        extern thread_local struct processor *      volatile this_processor;
    6768
    6869        static inline void ?{}( __spinlock_t & this ) {
     
    112113        }
    113114
    114         // Lock the spinlock, spin if already acquired
    115         static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    116                 for ( unsigned int i = 1;; i += 1 ) {
    117                         if ( __lock_test_and_test_and_set( this.lock ) ) break;
    118                         yield( i );
    119                 }
    120                 disable_interrupts();
    121                 __cfaabi_dbg_debug_do(
    122                         this.prev_name = caller;
    123                         this.prev_thrd = this_thread;
    124                 )
    125         }
     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        // }
    126127
    127128        static inline void unlock( __spinlock_t & this ) {
     129                enable_interrupts_noPoll();
    128130                __lock_release( this.lock );
    129                 enable_interrupts_noPoll();
    130131        }
    131132#endif
Note: See TracChangeset for help on using the changeset viewer.