Changeset dbe9b08 for src/libcfa/bits


Ignore:
Timestamp:
Jan 25, 2018, 5:02:09 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:
91496f3
Parents:
6e0f4bd
Message:

Spinlocks are now non-preemptive, stack-traces should print correctly

Location:
src/libcfa/bits
Files:
1 added
1 edited

Legend:

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

    r6e0f4bd rdbe9b08  
    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;
     
    6873        static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    6974                _Bool result = __lock_test_and_test_and_set( this.lock );
    70                 __cfaabi_dbg_debug_do(
    71                         if( result ) {
     75                if( result ) {
     76                        disable_interrupts();
     77                        __cfaabi_dbg_debug_do(
    7278                                this.prev_name = caller;
    7379                                this.prev_thrd = this_thread;
    74                         }
    75                 )
     80                        )
     81                }
    7682                return result;
    7783        }
     
    99105                        #endif
    100106                }
     107                disable_interrupts();
    101108                __cfaabi_dbg_debug_do(
    102109                        this.prev_name = caller;
     
    111118                        yield( i );
    112119                }
     120                disable_interrupts();
    113121                __cfaabi_dbg_debug_do(
    114122                        this.prev_name = caller;
     
    119127        static inline void unlock( __spinlock_t & this ) {
    120128                __lock_release( this.lock );
     129                enable_interrupts_noPoll();
    121130        }
    122131#endif
Note: See TracChangeset for help on using the changeset viewer.