Ignore:
Timestamp:
Jul 4, 2017, 9:40:16 AM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
208e5be
Parents:
9c951e3 (diff), f7cb0bc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into references

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel_private.h

    r9c951e3 rb1e63ac5  
    2121#include "thread"
    2222
     23#include "alarm.h"
     24
     25#include "libhdr.h"
     26
    2327//-----------------------------------------------------------------------------
    2428// Scheduler
     
    3539//-----------------------------------------------------------------------------
    3640// Processor
    37 struct processorCtx_t {
     41coroutine processorCtx_t {
    3842        processor * proc;
    39         coroutine_desc __cor;
    4043};
    41 
    42 DECL_COROUTINE(processorCtx_t);
    4344
    4445void main(processorCtx_t *);
     
    4748void finishRunning(processor * this);
    4849void spin(processor * this, unsigned int * spin_count);
     50
     51struct system_proc_t {
     52        processor proc;
     53
     54        alarm_list_t alarms;
     55        spinlock alarm_lock;
     56
     57        bool pending_alarm;
     58};
     59
     60extern cluster * systemCluster;
     61extern system_proc_t * systemProcessor;
     62extern thread_local processor * this_processor;
     63
     64static inline void disable_interrupts() {
     65        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, 1, __ATOMIC_SEQ_CST );
     66        assert( prev != (unsigned short) -1 );
     67}
     68
     69static inline void enable_interrupts_noRF() {
     70        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     71        verify( prev != (unsigned short) 0 );
     72}
     73
     74static inline void enable_interrupts() {
     75        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     76        verify( prev != (unsigned short) 0 );
     77        if( prev == 1 && this_processor->pending_preemption ) {
     78                ScheduleInternal( this_processor->current_thread );
     79                this_processor->pending_preemption = false;
     80        }
     81}
    4982
    5083//-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.