Changeset 58775d30 in mainline for kernel/generic/include/preemption.h


Ignore:
Timestamp:
2015-03-16T16:07:21Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2003739
Parents:
6069061 (diff), 795e2bf (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:

Mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/preemption.h

    r6069061 r58775d30  
    3636#define KERN_PREEMPTION_H_
    3737
    38 extern void preemption_disable(void);
    39 extern void preemption_enable(void);
     38#include <arch.h>
     39#include <compiler/barrier.h>
     40#include <debug.h>
     41
     42#define PREEMPTION_INC         (1 << 0)
     43#define PREEMPTION_DISABLED    (PREEMPTION_INC <= THE->preemption)
     44#define PREEMPTION_ENABLED     (!PREEMPTION_DISABLED)
     45
     46/** Increment preemption disabled counter. */
     47#define preemption_disable() \
     48        do { \
     49                THE->preemption += PREEMPTION_INC; \
     50                compiler_barrier(); \
     51        } while (0)
     52
     53/** Restores preemption but never reschedules. */
     54#define preemption_enable() \
     55        do { \
     56                ASSERT(PREEMPTION_DISABLED); \
     57                compiler_barrier(); \
     58                THE->preemption -= PREEMPTION_INC; \
     59        } while (0)
     60
    4061
    4162#endif
Note: See TracChangeset for help on using the changeset viewer.